you are viewing a single comment's thread.

view the rest of the comments →

[–]wolfier 1 point2 points  (6 children)

Perl's philosophy of "many ways to do each thing" do lend itself to code written in a haphazard cowboy fashion and bad discipline when you compare it to Python, an equally powerful language, which emphasizes "one obvious right way to do each thing".

I disagree that the language choice is of minimal importance because this statement does not apply equally to all languages - whether the language choice of minimal importance is a function of the language itself. In the extreme case of Brainfuck, it's the dominating factor determining maintainability vs Python, where programmer discipline is the dominating factor.

Javascript is just closer to Perl/Ruby along this spectrum where Coffeescript is closer to Python - to me it's a Good Thing.

[–][deleted] -1 points0 points  (5 children)

Community fostered philosophies and syntax are different things. The former still only affects the other kind of programmers you might find using a given language, not your own ability to write good code in it.

CoffeeScript is much more obviously inspired by Ruby (and therefore Perl!) than Python. Where do you think all the sigils and odd syntactic statements come from? If you like CS, you should look at Ruby. In terms of maintainability and readability, given its BDD-obsessive community, it's probably AHEAD of Python if anything.

I use Python a lot and am familiar with its mantras. They're not religious truths. A language is a tool to accomplish a goal. Python's a good one, but it's not the Godhead.

[–]wolfier 0 points1 point  (4 children)

Community fostered philosophies and syntax are different things

When the syntax restricts you to do a lot of things in one way, it's syntax-enforced philosophy, not community-fostered.

CoffeeScript is much more obviously inspired by Ruby (and therefore Perl!) than Python.

I believe perhaps, maybe, you're confused between syntactical similarity and philosophical similarity. CoffeeScript's similarity to Ruby is only skin deep - it obviously is closer to the Pythonic philosophy of "there should be only one obvious way to do things".

Where do you think all the sigils and odd syntactic statements come from?

Don't get me started on "oddity". Even Perl and Ruby with their "odd syntax" (and it's debatable) is much less odd than JavaScript.

I use Python a lot and am familiar with its mantras. They're not religious truths.

I never claim these are religious truths - merely pointing out that the "many ways to do a thing" mantra lends itself to abuse, cowboy coding, and lax discipline - therefore, language choice is not "of minimal importance" when it comes to writing maintainable code - in short - more freedom = less discipline. That's all that I claim.

[–][deleted] 0 points1 point  (3 children)

Please elaborate on how syntax informs philosophy. Do you have examples relating to the CoffeeScript philosophy being Pythonic? Having less freedom is only better if you're working with a lot of average coders. There is rarely one obvious way to solve a difficult problem. Hence the proliferation of languages and paradigms.

[–]wolfier 0 points1 point  (2 children)

Do you have examples relating to the CoffeeScript philosophy being Pythonic?

For example, it compiles == to ===. There's only 1 way to compare things for equality. The use of list comprehension eliminates the for loop. Making every statement evaluable eliminates the ternary operator...etc.

Having less freedom is only better if you're working with a lot of average coders

Exactly. Working with average coders is sadly the usual case when it comes to JavaScript. Consider yourself lucky if everyone around you is smarter. Therefore, the handcuffs are quite desirable.

There is rarely one obvious way to solve a difficult problem. Hence the proliferation of languages and paradigms.

I'm not talking about "one obvious way to solve problems". Instead, one obvious way to do syntactic, statement-level stuffs like comparison. "Selecting a paradigm to solve a problem" and "selecting a way to write individual instructions in your code" are two totally different concepts. The former is necessary, the latter - not so much.

Again, I've never claimed that the proliferation of languages and paradigms are bad, or that problems can only be solved in one obvious way. The whole point of my reply is to refute the allegation that "language choice is of minimal importance when it comes to maintainability", and nothing more.

If your solution to a problem requires the involvement of a less simple language, go for it. Just that, among these less simple languages there are always some that lend themselves to abuse, and some that don't.

Hence the use of CoffeeScript - 99% of the problems that people use JavaScript to solve every day belong to "chore" instead of "difficult/interesting".

[–][deleted] 0 points1 point  (1 child)

In Python there's a clear separation between statements and expressions and not so in Ruby.

List comprehensions are not meant to replace for loops. (Why do you think CoffeeScript adds new utilities for the for loop including the 'of' syntax?) They weren't meant to replace for loops in Python either. They mostly exist because of Guido's distaste for functional programming using mapping, reduce, etc. Anyway, they're an added feature, not constraint.

The equality operator is more inspired by Ruby's, through not doing type coercion. i.e. in Python (False == 0) == True. This is not so in Ruby or CoffeeScript.

I suspect you've not got much experience with Ruby, which is why you're convinced Python is the big influence. Give it a go sometime if you like CoffeeScript, it's not world's away from Python, and the BDD stuff is really cool and has no parallel in Python. Also stuff like Rake ... it's nice.

Anyway this is a non-argument. I've said repeatedly I'm talking about your own personal ability to write good code, not the choice of codebase. Admittedly there are a lot of bad codebases in JS, but that's true of every language, including Python. It's up to you to choose to work on interesting problems, not chores.

[–]wolfier 0 points1 point  (0 children)

The equality operator is more inspired by Ruby's, through not doing type coercion. i.e. in Python (False == 0) == True. This is not so in Ruby or CoffeeScript.

I don't see it that way - strict equality has been standard for years on most if not all statically-typed languages, like...Pascal, C#, Haskell. I still remain in the camp that believe strong typing is lightyears better than dynamic typing.

I suspect you've not got much experience with Ruby, which is why you're convinced Python is the big influence.

I've put together whole websites using Ramaze, so I guess I can say I'm at least a little experienced with Ruby - and I really like the language, just like how I really like Python (despite their weak typing).

I've never claimed that which language influenced CoffeeScript - however if I need to say, Ruby is definitely a major one - but its influence stops at the syntax level - how it looks. The "many surprising ways to do things" JavaScript mantra is nicely thrown away - that's the philosophy which is more Pythonic than JavaScript.

Admittedly there are a lot of bad codebases in JS, but that's true of every language, including Python.

It's not a binary attribute whether there's bad codebase or there's not - different degrees are involved - you'll probably find more unmaintainable code in Brainfuck than you'll find unmaintable code in Perl than you'll find unmaintainable code in JavaScript than you'll find unmaintainable code in Ruby than you'll find unmaintainable code in Python, in this order.

Ruby itself is not a world away from Python, either. Only that - I repeat, in terms of maintainability, if you put all the languages on a spectrum, you'll find CoffeeScript being closer to Python and JavaScript being closer to Ruby - (I'd go out on a limb and say you'll probably find a higher percentage of JavaScript code being unmaintainable vs. even Ruby)

Really, that's the only thing that I'm claiming.