User: Password:
|
|
Subscribe / Log in / New account

Reitter: Answering the question: "How do I develop an app for GNOME?"

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 7, 2013 1:44 UTC (Thu) by ThinkRob (subscriber, #64513)
In reply to: Reitter: Answering the question: "How do I develop an app for GNOME?" by HelloWorld
Parent article: Reitter: Answering the question: "How do I develop an app for GNOME?"

> Well, actually it's pretty hard to screw up exception handling in Java due to checked exceptions. You have to write additional code to ignore an error, there's not much more a language can do.

Oh no, there are ways.

Like someone deciding to make a base exception class that extends RuntimeException thus does not need explicit 'try'/'catch' handling or 'throws' declarations.

Sadly, this is not purely hypothetical. I've worked on codebases where this was the case; damn near everything was a runtime exception. It was very explodey.


(Log in to post comments)

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 7, 2013 6:15 UTC (Thu) by khim (subscriber, #9252) [Link]

It was still relatively safe. Explodey programs are bad, but programs which are silently doing the wrong thing are worse. And languages like Javacript or PHP tend to produce exactly such a thing.

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 7, 2013 8:23 UTC (Thu) by ekj (guest, #1524) [Link]

PHP is indeed fucked up, but most of that is just a case of "we made dumb choices once upon a time, and now we can't fix it because then we'd not be backwards compatible".

Nobody really thinks it's a good idea, for example that "0.0" == 0 is true but if(0) and if("0.0") has opposite effects. (i.e. despite the fact that "0.0" is claimed to be equal to 0, nevertheless one of these is considered "true" in a boolean context, while the other is false.

if ( $a == $b && $a && !$b) is potentially true in PHP, and that's just *one* example of the mistakes made while designing this language.

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 7, 2013 11:58 UTC (Thu) by khim (subscriber, #9252) [Link]

if ( $a == $b && $a && !$b) is potentially true in PHP, and that's just *one* example of the mistakes made while designing this language.

Well, it look like we are in violent agreement, then. JavaScript's analogue:

> a = "0"
  "0"
> b = 0
  0
> a == b && a && !b
  true

JavaScript is fucked up for the very same reason PHP is fucked up: they try to "silently fix novice's errors" - and in real programs this tends to lead to security holes sooner or later (usually sooner). Neither PHP not JavaScript should be used directly "as is". Never. Solution for PHP: don't. Just forget about PHP and use some other languages if posible. There are many of them: Java, Python, even C or Perl are better then PHP. Just don't. Solution for JavaScript: use some higher-level language which is compiled to JavaScript. There are quite a few contenders at this time: CoffeeScript, TypeScript, even subset of Java (if you use GWT).

To add JavaScript to your desktop environment as a primary development tool? Gosh, what are they thinking? Do they hate developers this much?

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 7, 2013 13:38 UTC (Thu) by ekj (guest, #1524) [Link]

Yeah. We appear to agree. I'm just tired of those people who think that these problems can only be solved (or atleast improved upon) by having a statically typed language.

Python is, IMHO proof that it's possible to solve many of these problems and have a cleaner, safer language while remaining dynamically typed.

In Python 0 == "0" is False (indeed 0 == any_string_whatsoever is False)

Reitter: Answering the question: "How do I develop an app for GNOME?"

Posted Feb 7, 2013 16:25 UTC (Thu) by khim (subscriber, #9252) [Link]

Yeah. We appear to agree. I'm just tired of those people who think that these problems can only be solved (or atleast improved upon) by having a statically typed language.

These programs can not be ever be solved (you can write Fortran in any language) but they can be reduced. Statically typed languages are on one side of the spectrum (and there there are different shades of gray, too): a lot of problems are detected when you try to compile program. Dynamically typed languages are the next best thing: problems are detected in runtime and end user observes see "[x is out of range]" instead of "there are no page to edit" message, but the PHP is at the other end of spectrum: user does not see anything wrong while it's data is slowly corrupted beyond repair. JavaScript is close behind.

Python is, IMHO proof that it's possible to solve many of these problems and have a cleaner, safer language while remaining dynamically typed.

Sure. But it still does not make it usable for an industrial projects. Which are defined not by size but by staff turnover: it's not uncommon to see project handled by 4 or 5 generations of programmers in the course of 10 years in a commercial environment - and each generation start with the code but without help from the previous generation. Dynamically typed languages almost wholly unsuitable for such a development, statically typed languages fare much better.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds