Anti-OOP... stupid?
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Feb 14 16:08:23 PST 2012
On Tue, Feb 14, 2012 at 06:42:02PM -0500, bearophile wrote:
> H. S. Teoh:
>
> > I mean, if you take OO to the extreme, that would require excluding all
> > those evil procedural constructs like if statements and for loops, and
> > write everything in terms of invoking object methods... like this
> > monstrosity:
> >
> > class MyClass {
> > void myMethod() {
> > IntVariable i;
> > ForLoopFactory.create(
> > new IntSetter(i.address(), new Number(0)),
> > new BooleanCondition(
> > new LessThanComparator(i.address(),
> > 100)),
> > new IntAdder(&i, 1),
> > new IfStatement(
> > new EqualComparator(i.address(),
> > new Number(42)),
> > new FunctionCaller(writeln.address(),
> > new String("Found it!")),
> > )
> > ).execute();
> > }
> > }
> >
> > which is, of course, completely ridiculous.
>
> Smalltalk is a language composed of a very small number of parts,
> where every thing is an object. So in a sense, you write code like
> that, with a better syntax.
[...]
True, but that doesn't mean that it's evil to not program in Smalltalk.
:-)
T
--
Don't modify spaghetti code unless you can eat the consequences.
More information about the Digitalmars-d-learn
mailing list