The Artima Developer Community
Sponsored Link

Weblogs Forum
What Do You Consider "Readable" Code?

34 replies on 3 pages. Most recent reply: Apr 15, 2009 1:24 PM by Marty Fried

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 34 replies on 3 pages [ « | 1 2 3 ]
lorenzo bolzani

Posts: 1
Nickname: lorenzo
Registered: Sep, 2005

Re: What Do You Consider "Readable" Code? Posted: Mar 29, 2009 8:40 AM
Reply to this message Reply
Advertisement
Going back to the original article, to me the question looks a lot like math notation.

1 + 2 + 3 + 4 + 5 + 6 + 7

it's a lot more explicit than the corresponding epsilon notation. And so on for integrals, nabla, etc.

In other words it depends how much you have to put into the text and how much you can assume in the reader.
The same is true for natural language

The flying thing you use to go from a place to another

could be considered more "clear" than "airplane" to a foreign language reader.

If you use a language you should _know_ that language as you should do if you want to write a novel in a foreign language.

Language knowledge is not an option (at least for "professional" work).

Juancarlo Añez

Posts: 12
Nickname: juanco
Registered: Aug, 2003

Re: What Do You Consider "Readable" Code? Posted: Mar 29, 2009 10:57 PM
Reply to this message Reply
>> If you're well versed in Scala, then I think you will be able to guess how it works, because there's really only one way it could work <<

The life-long issue!

Programmers should be well-versed in the languages and APIs they program in, as well as in algorithms, and computing theory. Period. Then the economics of fewer lines of code (handled by smarter compilers and interpreters) step in, and those are for real.

The rest is poop. There is *no* good programming language for those unwilling or unable to learn about abstractions.

Mark Thornton

Posts: 275
Nickname: mthornton
Registered: Oct, 2005

Re: What Do You Consider "Readable" Code? Posted: Mar 30, 2009 12:43 AM
Reply to this message Reply
> Programmers should be well-versed in the languages and
> APIs they program in, as well as in algorithms, and
> computing theory. Period. Then the economics of fewer

What about systems that are written in multiple languages? It may be unrealistic to expect everyone to be well versed in all of them. If the other languages are not comprehensible without being inducted into the priesthood, then you end up with "here be dragons" zones.

em vee

Posts: 2
Nickname: emvee
Registered: Apr, 2009

Re: What Do You Consider "Readable" Code? Posted: Apr 7, 2009 8:52 PM
Reply to this message Reply
The author states: "I think it is a fairly well accepted tenet that fewer lines of code is generally better".

Oh yeah? Maybe in blogs and forums and well written articles, but in the working world?

Every commercial programming environment I've ever worked at looked at programmer productivity in terms on amount of code.

Some were more blunt about it; some were sneaky about it, but it always came down to how much code you wrote.

When I try to refactor code or do things more consisely, the PHB's always say it's a waste of time.

Not saying I like it, just the way it is.

Marty Fried

Posts: 1
Nickname: linfidel
Registered: Apr, 2009

Re: What Do You Consider "Readable" Code? Posted: Apr 15, 2009 1:24 PM
Reply to this message Reply
> What about systems that are written in multiple languages?
> It may be unrealistic to expect everyone to be well versed
> in all of them. If the other languages are not
> comprehensible without being inducted into the priesthood,
> then you end up with "here be dragons" zones.

I'm a little late, but your post brings up what I was thinking for most of the thread - the question wasn't really about what language is most readable, I didn't think; sometimes, you don't have a choice of language - you may need to use whatever language is used for the rest of the project.

So, it seems like the comments should be more along the lines of general guidelines that work in many languages.

I worked with an engineer who drove me crazy with logic statements (C/C++) like this:
if (condition)
;
else
doSomething();
He had trouble with negative conditions, so his conditions didn't always say what he was really doing.

If I need to test for some variable equal to zero, I'd rather write "if (x == 0)" than "if (x)" like a lot of people do, or did in the days of C, because x is not a boolean, and my way emphasizes that it is checking for a value, not a condition.

I hope these aren't too simplistic, but they are just easy examples off the top of my head.

But good thread, nonetheless.

Marty Fried

Flat View: This topic has 34 replies on 3 pages [ « | 1  2  3 ]
Topic: What I learned at Java Posse Roundup '09 Previous Topic   Next Topic Topic: Mixins considered harmful/1

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use