Re: VB6 Feature not included in .NET
- From: Joergen Bech <jbech<NOSPAM>@<NOSPAM>post1.tele.dk>
- Date: Fri, 22 Jun 2007 03:00:13 +0200
What I am saying is that it is a best practice to keep functions and
methods as short as possible/appropriate. Typically, if a function
extends over more than 10-30 lines, it is probably doing too much
work and could be broken down into smaller, more readable chunks.
Even within a single unit of work, there might be complex conditions
that could be turned into a single verb to improve readability.
As such, you would never need to use PageUp/PageDown to
browse a single function as any function would always fit in its
entirety on the screen - at least vertically.
Of course, there are a few exceptions where one could still be
forgiven for writing longer functions.
In my current project, I have yet to write a single class bigger than
a couple of thousand lines. I usually split classes of such magnitude
into partial classes in order to organize the code into manageable
chunks. I am not a great fan of regions. I prefer having all my code
expanded at all times.
Also: One or more files per class. Never multiple classes per file,
even though this is possible in VB.Net (but was not the case in VB6).
When you ask about spreading functions over a large number of
files, even though a lot of functions are very similar, it sounds to
me like you are still thinking about the copy/paste approach to
coding one was prone to do in VB6 which - though it supported
encapsulation - did not support inheritance.
I used to think I would never need inheritance for much - if anything.
Now, I use inheritance all the time and do not have a lot of functions
that are very similar, as you put it.
/Joergen Bech
On Fri, 22 Jun 2007 09:50:45 +1200, "Luke R" <dont@xxxxxxx> wrote:
I dont understand... the only way that this feature would not be convenient
is if you only had a very small number of functions within a physical file.
When dealing with large projects, is it a best practice to spread your
functions over a large number of files, even if you have alot of functions
that are very similar?
"Joergen Bech @ post1.tele.dk>" <jbech<NOSPAMNOSPAM> wrote in message
news:fudl73dh2m1hslq7rvvcbc49uln9geefqs@xxxxxxxxxx
On Thu, 21 Jun 2007 16:17:49 +1200, "Luke R" <dont@xxxxxxx> wrote:
One thing i used to use alot in vb6 was that tiny little button in the
bottom left of the code window which allowed you to view either the whole
code file, or just the function/sub you are currenly in.
This was awesome when dealing with big functions inside big code files.
You
could page up and down without accidentally entering the next/previous
function. Then they got rid of it in .NET and now we have this treeview
style collapsable thing which just doesnt cut it.
I suggest they bring it back. It was a really useful feature.
If some of your functions are so big that you need to use
PageUp/PageDown to browse through them, I think you have
bigger problems than missing this feature :)
I say: Good riddance to this feature.
Sorry. Don't mean to be rude, but I strongly feel that this
feature is superfluous if one follows standard best practices
and keep cyclomatic complexity down in all methods and
functions. Anything that encourages the developer to move
away from the old stream-of-thought approach to writing
functions is welcome.
Regards,
Joergen Bech
.
- Follow-Ups:
- Re: VB6 Feature not included in .NET
- From: Luke R
- Re: VB6 Feature not included in .NET
- References:
- VB6 Feature not included in .NET
- From: Luke R
- Re: VB6 Feature not included in .NET
- From: Joergen Bech
- Re: VB6 Feature not included in .NET
- From: Luke R
- VB6 Feature not included in .NET
- Prev by Date: Re: Reusable reporting form and VS2005 report
- Next by Date: How to add a UAC Manifest to Managed Code of VB.NET
- Previous by thread: Re: VB6 Feature not included in .NET
- Next by thread: Re: VB6 Feature not included in .NET
- Index(es):