[fpc-pascal]FP newbie
Marco van de Voort
marcov at stack.nl
Thu Nov 13 18:12:45 CET 2003
> > same thing more or less.
> >
> > Both can be solved properly, and personally I find the
> > workaround presented in the article uglier than the simple
> > variable in the implementation of the unit.
> >
> > ----
>
> I think you missed the point of the article. I had no intention
> to list the benefits of using class attributes. I just wanted to
> share a technique that would enable developers that wish to use
> class attributes to be able to use them.
>
> In my opinion, class fields/properties do bring about many
> benefits. Not only do they allow data hiding on the class
> level, they also allow global values to be bound to their
> classes, and not left outside the class code. A value you
> define that is only meaningful in the class context should
> in fact be encapsulated in the class.
Nice and stylish, but still no practical reason.
> Also, and perhaps this is a big point to note, using global or unit local
> variables is questionable OO programming technique. If you really wish to
> develop in OO style, you will stay away from globals and try to keep all
> your class data within your class definition, and all your object data
> within your object instance.
That is exactly why I use a "multi-paradigm" language like Object Pascal, because
I'm able to use the strengths of those.
If I want to use pure OO, I'll use SmallTalk. OO is a tool, not a religion.
> > More important is the Pascal background I think. The Wirthian
> > languages always were relatively small, consistent and clean,
> > and usually the argument is that this makes compilers easier
> > to implement, and avoids nasty side effects, which you are
> > bound to encounter when programs get big (read way over a
> > hundred thousand lines)
>
> but new features will always come along- it is inevitable.
> the secret is knowing what is worthwile supporting in new
> compiler versions...
That is exactly the reason why I'm having this discussion. There
have to be benefits, rather than just stylish correctness.
I'd rather have the time spent on e.g. generics (what C++ calls templates),
which are also fashionable, but at least I can view them as a serious tool.
FPC needs these discussion even more than e.g. Delphi. Borland can
commission a couple of programmers for a year to follow what turns out to be
a dead end.
For FPC, that same "year" is much longer, since the developers do this part
time. Adding rare used features.
This is also a reason why FPC is not embarking on some .NET or Java bytecode
adventure.
More information about the fpc-pascal
mailing list