Search code examples
programming-languages

Is there a language that encourages good coding practices?


While I love PHP I find its biggest weakness is that it allows and even almost encourages programmers to write bad code.

Is there a language that encourages good programming practices? Or, more specifically, a web-related language that encourages good practices.

I'm interested in languages who have either a stated goal of encouraging good programming or are designed in such a way as to encourage good programming.


Solution

  • Well, it depends on what you consider a web language. Smalltalk definitely encourages best practices, and there's even a crazy web framework written in it (Seaside). It's very different and you can still do bad things. You're simply encouraged to do otherwise.

    Eiffel's big thing is Design By Contract. It's a nifty organizational requirement that encourages testing and assertions everywhere.

    Python is great, but it doesn't really encourage good practices. Well, if indentation is a best practice, then Python definitely enforces it.

    Other languages don't really encourage you to do bad things like PHP does. You can also write great (and proper) code in PHP. People often forget that you can disable much of the nastiness in the interpreter (globals, slashes, etc.). You needn't jump ship just because PHP merely entices you to the dark side.