im not a hard core programmer, but i know a thing or two about maintenence of code, especially code not written. Ill use live examples at the expense of being shot alive.
@Rad, I think I clarified the statement about clarity and code brevity.I also think that the examples you have laid out are not the best ideal, you can give better ones more likely to be encountered in day- to-day life.@Peter, the second example is not as readable as the first UNLESS you are accustomed to the ternary operator in C-type languages. Personally, I would use it any day to the ordinary if / else statement.If I were a budding programmer, I would stick to the advice given by @Dennis Mbuvi. Its a lot more sobbber.Martin.On Tue, Jun 26, 2012 at 6:05 PM, Rad! <conradakunga@gmail.com> wrote:
Martin here's th example.First is a one line regex to validate an email address
Second is a multi line oneWhich has more lines of code? The second.Which is clearer? I dare say the scond
On Tuesday, June 26, 2012, Rad! wrote:
On Tuesday, June 26, 2012, Martin Chiteri wrote:Hi @Rad,On Tue, Jun 26, 2012 at 5:01 PM, Rad! <conradakunga@gmail.com> wrote:
Lines of code is a completely outdated metric.This still matters, especially when you have to maintain software developed by many people over many years. The first concern is the time it takes to write the program (Man-months / years), and by extension this affects the cost in monetary terms. The lesser the SLOC the better in my opinion, especially for those of us who are not as good at handling complexity as well.I am inclined to disagree. Fewer lines of code does not necessarily mean easy to maintain. The best example I can give is the POSIX regular expression to validate email addresses. This you can get in a few lines. It is a MONSTER. But to maintain it is hell on earth.And cooling lines of code with maintain ability is a demonstrably false assertion. Maintainability is not a function of lines of code. It is a function of the clairity of code, algorithmic design, control flow, etcThis is also true, but if given two or more programs written with equal clarity, which one would you prefer supposing they solve the same problem in exact measures? It may also help to also note that in the real world, much more time is spent in maintaining software than writing "new" lines of code.You're mixing terms here. Clarity and lines of code are not interchangeable terms. Something can have a lot of code and be very clear. Conversely very few lines of code and very unclear.On the other hand well written Python and Ruby are sources are *unUsually* readable, don't you think so? Compared to say the same functionality say expressed in JAVA, C# or PHP? Some of the design decisions implicitly built into some of these languages is the ability to make them more readable and maintainableFinally, if lines of code were a consideration, Lisp and its children (scheme, CAML, etc) areeven more terseThis is also arguably true. Personally, I have never really wrapped my head around LISP, its descendants and its concepts. Maybe it was out of not trying too much .....Martin.
P.S: The reason the example given are metrics on LISP is that Norvig is probably the greatest LISPer alive (besides Paul Hamming [ www.paulgraham.com/ ] ) and the late John McCarthy.On Tuesday, June 26, 2012, Martin Chiteri wrote:Well, the article itself does not have "hard" numbers to support their premises. There is an example here [ http://norvig.com/python-lisp.html ], for starters.>>>> Sigh, not again
Martin.
On 6/26/12, Rad! <conradakunga@gmail.com> wrote:
> Absolutely absurd article.
>
> Lines of code as a metic?
>
> On Tuesday, June 26, 2012, Martin Chiteri wrote:
>>
>> I agree with what @Gisho and @Brian say. Sometimes (actually most of the
>> times) it is immaterial what language you use. Your skill / experience
>> with it / them and the tools available make a larger difference. The
>> problem set approached may also be an important factor.
>>
>> What I found interesting is the kind of reaction the article sparked among
>> the PERL zealots
>> [ http://reliscore.com/blog/why-every-programmer-should-learn-python-or-ruby/ ].
>> It would have been amusing to see something similar on this list. :P
>>
>> Martin.
>>
>> On Tue, Jun 26, 2012 at 4:08 PM, gisho <gichuhie@gmail.com> wrote:
>>>
>>>
>>> i don't want to get into this but python delivers whats written on the
>>> tin (having coded with java/c#/vb/php/c++)
>>>
>>>
>>>
>>>
>>> On Tue, Jun 26, 2012 at 4:02 PM, Brian Ngure <brian@pixie.co.ke> wrote:
>>>>
>>>>
>>>> In any language, the problems that normally arise are usually PEBKAC.
>>>> Bad coding, bad decisions, etc...
>>>>
>>>>
>>>> On Tue, Jun 26, 2012 at 3:42 PM, Martin Chiteri
>>>> <martin.chiteri@gmail.com> wrote:
>>>>>
>>>>> http://www.coderbuzz.com/discussion/4/why-every-programmer-should-learn-python-or-ruby
>>>>>
>>>>> Martin.
>>>>> _______________________________________________
>>>>> Skunkworks mailing list
>>>>> Skunkworks@lists.my.co.ke
>>>>> ------------
>>>>> List info, subscribe/unsubscribe
>>>>> http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
>>>>> ------------
>>>>>
>>>>> Skunkworks Rules
>>>>> http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
>>>>> ------------
>>>>> Other services @ http://my.co.ke
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards
>>>>
>>>> Brian Ngure
>>>
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
“The twentieth century has been characterized by three developments of great political importance: the growth of democracy, the growth of corporate power, and the growth of corporate propaganda as a means of protecting corporate power against democracy” |