Is it easy for a bad programmer to write overly complicated code? (was: Re: Normal For Loop)

Quoting Robert Klemme (shortcutter@googlemail.com):

Plus: Ruby is so expressive that the description of requirements for
the code generator is probably not shorter than the Ruby code itself.
"I want all items with price higher than $10" is about as complex as
"items.select {|it| it.price > 10}". So why generate if you can write
the Ruby down with the same effort?

When I mention code generators, I mean something that can be operated
without the help of a programmer. For you and me, the complexity of
your two examples is comparable. A non-programmer, on the other side,
will find the meaning of the first example quite obvious, while the
second example may give the impression of being a meaningless jumble
of characters.

Carlo

···

Subject: Re: Is it easy for a bad programmer to write overly complicated code? (was: Re: Normal For Loop)
  Date: gio 24 ott 13 06:01:10 +0200

--
  * Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
  * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

Now, this is an interesting question: how formal would an input for a
code generator have to be? Considering current state of affairs of
speech recognition and AI I'd guess that you need at least some
formalism. Well, unless of course you can afford "Deep Thought" or
other non fictional supercomputers (what was the name of this IBM
thingy which won that quiz show again?).

Kind regards

robert

···

On Thu, Oct 24, 2013 at 7:18 PM, Carlo E. Prelz <fluido@fluido.as> wrote:

        Subject: Re: Is it easy for a bad programmer to write overly complicated code? (was: Re: Normal For Loop)
        Date: gio 24 ott 13 06:01:10 +0200

Quoting Robert Klemme (shortcutter@googlemail.com):

Plus: Ruby is so expressive that the description of requirements for
the code generator is probably not shorter than the Ruby code itself.
"I want all items with price higher than $10" is about as complex as
"items.select {|it| it.price > 10}". So why generate if you can write
the Ruby down with the same effort?

When I mention code generators, I mean something that can be operated
without the help of a programmer. For you and me, the complexity of
your two examples is comparable. A non-programmer, on the other side,
will find the meaning of the first example quite obvious, while the
second example may give the impression of being a meaningless jumble
of characters.

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Robert Klemme wrote in post #1125550:

···

On Thu, Oct 24, 2013 at 7:18 PM, Carlo E. Prelz <fluido@fluido.as> > wrote:

When I mention code generators, I mean something that can be operated
without the help of a programmer.

Now, this is an interesting question: how formal would an input for a
code generator have to be?

robert

Bearing in mind that the first one was COBOL, track record not looking
good so far... :slight_smile:

--
Posted via http://www.ruby-forum.com/\.