I changed the subject as I feel we are moving away from the topic.
My question was general, perhaps I'll try again -- is it easy for a bad
programmer to write overly complicated code?
Do you mean in general or specifically in Ruby vs. other programming
languages? Concluding from code I have seen I would say it is easy
for bad programmers to write overly complicated code - regardless of
language. It may be a tad less easy in Ruby as the syntax is pretty
clean and it is more difficult to produce unreadable code just by
doing syntax tricks.
Kind regards
robert
···
On Thu, Oct 24, 2013 at 12:11 PM, Roy Gardiner <lists@ruby-forum.com> wrote:
- write 'tight' code. They think that fewer keystrokes = good
- think their problem is 'complex' (never 'complicated') and thus must
have a complex solution -- they don't try to simplify.
- deliberately try out as many new features as they can, in live code,
to improve their own knowledge and to show off
- choose the difficult,complicated (but of course 'more comprehensive'
or 'more elegant')way over the easy, simple way of doing anything.
what I fear is that the variety of Ruby -- there seem to be any number
of ways of doing the simplest things -- may encourage them.
I certainly wrote overly complex and repetitive code when learning Ruby.
Not writing methods, writing all code in main, not using OO... sometimes
you have to make mistakes to fully understand the benefits of doing
things properly.
Goodness me, you seem to think I'm attacking Ruby. I'm not. I was
trawling (not, I hope, trolling) for opinion on a language design
feature. I didn't mean to offend you, I apologise.
So that no-one has to scroll back here are those characteristics again:
- write 'tight' code. They think that fewer keystrokes = good
- think their problem is 'complex' (never 'complicated') and thus must
have a complex solution -- they don't try to simplify.
- deliberately try out as many new features as they can, in live code,
to improve their own knowledge and to show off
- choose the difficult,complicated (but of course 'more comprehensive'
or 'more elegant')way over the easy, simple way of doing anything.
I am not talking about relatively inexperienced people open to
correction, but people who do this stuff habitually and defend it as
good practice.
- deliberately try out as many new features as they can, in live code,
to improve their own knowledge and to show off
You are putting two opposite concepts in the same basket. To show off
is of course bad. To improve one's knowledge is not only a good thing
- it is one of the fundamental reasons why we are here on this
planet.
The evil here is on the part of corporate employers, who couldn't care
less about the personal evolution of the programmers they employ, and
are after the fundamentally flawed holy grail of
programmers-as-commodity. You burn one, you get a new one from the
drawer.
These employers are afraid of hiring people who are brighter than they
are, and thus the code that is produced by their people is unescapably
mediocre.
Carlo
···
Subject: Is it easy for a bad programmer to write overly complicated code? (was: Re: Normal For Loop)
Date: gio 24 ott 13 12:59:40 +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)
In Ruby land we usually consider TMTOWTDI to be a good thing. Luckily
many of the multiple ways will be readable because of Ruby's API
design and clean syntax. I wouldn't worry too much about this. If
you do, then just pick another language with which you feel more
comfortable.
Kind regards
robert
···
On Thu, Oct 24, 2013 at 12:59 PM, Roy Gardiner <lists@ruby-forum.com> wrote:
Bad programmers
what I fear is that the variety of Ruby -- there seem to be any number
of ways of doing the simplest things -- may encourage them.
Let us suppose for the moment that all that is true. What do you
intend to do about it?
To me, none of the conditions you specified above are specific to
Ruby, or really any other language that I know. What you are
describing sounds more like a way some people approach learning in
general. It is a general truism that you have to be poor at something
before you can excel at something.
In the Ruby world, like no other I've encountered, there is a strong
emphasis on testing, and testing before development, and the concept
of refactoring early and often. I know this is not born out in
practice everywhere, especially in programming shops that happen to be
doing Ruby, and there's oceans of poorly written and designed Ruby
code out there, yet I'm still of the opinion that rubyists are more in
tune with the craft of programming than other cultures around other
languages. Sturgeon's Law will hold, regardless.
···
On Thu, Oct 24, 2013 at 5:59 AM, Roy Gardiner <lists@ruby-forum.com> wrote:
Bad programmers
- write 'tight' code. They think that fewer keystrokes = good
- think their problem is 'complex' (never 'complicated') and thus must
have a complex solution -- they don't try to simplify.
- deliberately try out as many new features as they can, in live code,
to improve their own knowledge and to show off
- choose the difficult,complicated (but of course 'more comprehensive'
or 'more elegant')way over the easy, simple way of doing anything.
what I fear is that the variety of Ruby -- there seem to be any number
of ways of doing the simplest things -- may encourage them.
Oh, no, not defending Ruby. The set of assertions you make about bad
programmers, though, is the characteristics of someone learning how to
become a better programmer, given sufficient practice at being bad at
something, receiving feedback and learning to improve.
···
On Fri, Oct 25, 2013 at 11:27 AM, Roy Gardiner <lists@ruby-forum.com> wrote:
Goodness me, you seem to think I'm attacking Ruby. I'm not. I was
trawling (not, I hope, trolling) for opinion on a language design
feature. I didn't mean to offend you, I apologise.
I am not sure I still understand what point you are trying to make or
what opinions you want to gather. In what ways would a programming
language make it harder or easier for people to write overly
complicated code who "do this stuff habitually and defend it as good
practice"? I mean, you seem to diagnose a certain intend here and as
all programming languages must be Turing complete to be useful I
cannot see what feature could there be to prevent or curtail this kind
of behavior.
Kind regards
robert
···
On Fri, Oct 25, 2013 at 7:38 PM, Roy Gardiner <lists@ruby-forum.com> wrote:
So that no-one has to scroll back here are those characteristics again:
- write 'tight' code. They think that fewer keystrokes = good
- think their problem is 'complex' (never 'complicated') and thus must
have a complex solution -- they don't try to simplify.
- deliberately try out as many new features as they can, in live code,
to improve their own knowledge and to show off
- choose the difficult,complicated (but of course 'more comprehensive'
or 'more elegant')way over the easy, simple way of doing anything.
I am not talking about relatively inexperienced people open to
correction, but people who do this stuff habitually and defend it as
good practice.
Subject: Is it easy for a bad programmer to write overly complicated
code? (was: Re: Normal For Loop)
Date: gio 24 ott 13 12:59:40 +0200
Sorry for the delay!
Quoting Roy Gardiner (lists@ruby-forum.com):
Bad programmers
<snip>
- deliberately try out as many new features as they can, in live code,
to improve their own knowledge and to show off
You are putting two opposite concepts in the same basket. To show off
is of course bad. To improve one's knowledge is not only a good thing
- it is one of the fundamental reasons why we are here on this
planet.
I chose my words carefully it's why I said 'live code'. Anyone
writing anything other than the simplest, easiest code to solve a
problem is (in my book anyway) a bad programmer. I have known any
number to 'bend' a solution to fit code they want to write.
The evil here is on the part of corporate employers, who couldn't care
less about the personal evolution of the programmers they employ, and
are after the fundamentally flawed holy grail of
programmers-as-commodity. You burn one, you get a new one from the
drawer.
A different discussion indeed...!
These employers are afraid of hiring people who are brighter than they
are, and thus the code that is produced by their people is unescapably
mediocre.
Carlo
People who won't hire others brighter than themselves in any field are
2nd rate, as you say. It's an infallible measure, IMO.
i've just across a ruby gem called flog Category: Code Metrics - The Ruby Toolbox which tests for
complexity of code. The higher the score, the more complex the code and
therefore the harder it is to test it.
This might be helpful.
···
On 26 October 2013 11:15, Robert Klemme <shortcutter@googlemail.com> wrote:
On Fri, Oct 25, 2013 at 7:38 PM, Roy Gardiner <lists@ruby-forum.com> > wrote:
> So that no-one has to scroll back here are those characteristics again:
>
>
> - write 'tight' code. They think that fewer keystrokes = good
> - think their problem is 'complex' (never 'complicated') and thus must
> have a complex solution -- they don't try to simplify.
> - deliberately try out as many new features as they can, in live code,
> to improve their own knowledge and to show off
> - choose the difficult,complicated (but of course 'more comprehensive'
> or 'more elegant')way over the easy, simple way of doing anything.
>
>
> I am not talking about relatively inexperienced people open to
> correction, but people who do this stuff habitually and defend it as
> good practice.
I am not sure I still understand what point you are trying to make or
what opinions you want to gather. In what ways would a programming
language make it harder or easier for people to write overly
complicated code who "do this stuff habitually and defend it as good
practice"? I mean, you seem to diagnose a certain intend here and as
all programming languages must be Turing complete to be useful I
cannot see what feature could there be to prevent or curtail this kind
of behavior.
I chose my words carefully it's why I said 'live code'. Anyone
writing anything other than the simplest, easiest code to solve a
problem is (in my book anyway) a bad programmer. I have known any
number to 'bend' a solution to fit code they want to write.
It becomes soon evident to anybody who cares for his/her code that
simple, linear (although *not* easy, at least concept-wise) code cuts
the cake much better than uselessly complex code. I reacted to your
usage of showing off and improving one's knowledge as comparable
concepts. I believe these two attitudes produce widely different
results. If you consider coding as craftsmanship, the first attitude
is detrimental to code quality, while the second one is instrumental
to code quality.
I want to add that 'easy' code can only solve elementary, or
extensively explored problems. At the point when you can use 'easy'
code, you are very close to the point where you can use code
generators as well.
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 03:55:47 +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)
I reacted to your
usage of showing off and improving one's knowledge as comparable
concepts. I believe these two attitudes produce widely different
results. If you consider coding as craftsmanship, the first attitude
is detrimental to code quality, while the second one is instrumental
to code quality.
I stand by the idea that putting into production more complex code than
needed just to improve one's knowledge *is* showing off -- and I'm sure
you've seen any number of people do it.
Not sure I agree here. If a method can be written with simple
straight forward code that just means that the developer has done a
good job at structuring design and code in a manner that one class /
method / function does one thing properly. I doubt that process can
be automated.
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?
Kind regards
robert
···
On Thu, Oct 24, 2013 at 4:14 PM, Carlo E. Prelz <fluido@fluido.as> wrote:
I want to add that 'easy' code can only solve elementary, or
extensively explored problems. At the point when you can use 'easy'
code, you are very close to the point where you can use code
generators as well.
I stand by the idea that putting into production more complex code than
needed just to improve one's knowledge *is* showing off -- and I'm sure
you've seen any number of people do it.
No. Either you do one thing, or you do the other. Notice the
difference: one thing is to write code and somehow improve one's
knowledge as a more or less welcome side effect. Another thing is to
focus one's effort on improving one's knowledge.
In the first case, it may well be that you are motivated by pride
(showing-off, or other). In the second one, you are not.
It is an aspect of the duality Constructiveness|Destructiveness. Quite
a fundamental one.
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 04:30:33 +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)