On 04/10/2011 16:41, Jürgen Hestermann wrote:
> In other words: It's nicer to work with ten 3000 lines units than
with one big 30.000 lines unit.
Why that? I would prefer the one unit including everything over having
multiple files (i.e. when searching for something). If it has no other
impact than I would always vote for having lesser files instead of
cluttering all into many files.
This sounds, as if units were to be split at random: Like start a new
unit every 3000 lines... (Well I am exaggerating of course).
What belongs together into one unit, is major part of the design, and
the size of units will be dictated by this. If you let your design being
dictated by fixing the unit size, then you got an issue.
And btw, if the size of a file (not unit) is a problem: include files.
Still you should aim, for keeping as little as possible in a unit. It
will improve code, by making sure, each class, has the minimum
dependencies possible. Intruducing unecesary dependencies, by adding to
much knowledge about other things into a class, is likely to cause
problems at some time.
> 2. classes were split instead of using parameterization. Instead of
adding a parameter to many methods, an abstract class and multiple
descendants are defined. This almost always duplicates code, but the
code itself has far less if-then-else blocks. OTOH it can create more
if-then-else outside the split classes.
Code is much more readable (understandable) when if-then-else blocks
and no OP-methods (like descendants) are used. You see all relevant
code in one block and there is no need to gather it from multiple places.
I do disagree. I really do disagree.
In fact, there are man y effort, to reduce "IF" blocks in code. Patterns
like "State" or "visitor" for example.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus