views:

81

answers:

3

Hi All:

Recently I'm pondering the characteristics of a good programming language. It's true that "There are a thousand Hamlets in a thousand people's eyes", like simplification, explicitness, readability and more.

But I'm wondering a good programming language should be consistent, which means everyone will write the same(at least very similar) codes to achieve the same functionality, which means everyone will read, understand, maintain others' codes easily and effectively. Not as flexible as everyone will write different codes in readability and quality for one functionality, which mostly depends on programmer's experience and skill.

Till now, I didn't find some languages which matches my definition of consistency, but I'm still looking for. Anyone knows any?

I'm not sure whether you agree with me or not? Please point out if anything wrong with my point. And leave your argument no matter you agree with me or not. Just leave your points and arguments.

Regards.

A: 

The Zen of Python contains:

  • There should be one-- and preferably only one --obvious way to do it.
Greg Hewgill
ya. But it's not true in reality.
Tower Joo
+1  A: 

Both, or either. Take the difference between Perl and Python. In Perl, tell someone to read data from a file and display it to stdout and you can get roughly 85,000 different permutations. In Python, you're likely to have 5-10. However, both are widely used, extremely powerful, highly efficient and capable of nearly any task.

Language choice comes down to personal preference and a bit of what you want to do. OO paradigms will lead to drastically different program structures from program to program, imperative programming paradigms will lead to very similar program structures from programmer to programmer, functional programming paradigms will be somewhere in between.

As an aside, I personally prefer the language to be flexible enough to let me design the application in the manner I see fit as there are times when performance of certain components are an absolute necessity while others they don't matter at all. A strict "One True Way" can place limits on what you do, but "There's More Than One Way To Do It" requires you to know which is the highest performance and make the tradeoff for readability vs. compactness vs. performance (not always mutually exclusive).

Matt
In short: Aim in the middle!
RCIX
+1  A: 

There's this great cartoon with a tree swing in every panel. One panel has a regular swing and says "what the customer needed". The next panel shows two seats - one on top of the other and says "what the customer asked for". Next is a swing with three stacked seats that says "what the programmer's built". Everyone has a mental picture of their expectations. And everyone's picture is different.

You can't achieve consistency in that kind of environment. If we can't achieve consistency, can we improve upon readability? Because the end goal is having code that other programmers can maintain.

I like literate programming. It arranges code in a human context - what makes sense for a person to read. A literate style more closely follows your mental model.

Even when I can't use the tools, that style has vastly improved the clarity and effectiveness of comments.

Robert Wohlfarth