Live data from Hacker News

Dynamic Languages are Unmaintainable

williamedwardscoder.tumblr.com

61–70 of 71 posts

Re: Dynamic Languages are Unmaintainable

#61
Are so many bugs really caused by type problems? I run into type based errors in Python almost never. It is not hard to keep track of dynamic types, and takes the same effort (or less) than static typed programming. In both cases, you have to know what type you are working with, right?

If you have this problem you have probably been trained to be sloppy by compilers.

Re: Dynamic Languages are Unmaintainable

#62

Earlier quoted context omitted.

I would also argue that you can get the benefits of a static type system with hardly any cost. Usually when people talk about dynamic vs static typing they imagine something like Ruby or Python vs Java, but there's no reason why you can't have a high-level, expressive language with static types. All you need is a sophisticated type-system and smart type-inference that works everywhere (not just locally) and you'll be…

OCaml, F#, Haskell all come to mind. Regarding total type inference, I am not sure though that any of those can do completely away without some manual type annotations. I still like to declare type annotations (especially in Haskell, the syntax in ML is a bit too ugly) for top-level functions.

standard ml (and thus haskell) has total type inference. the problem in haskell at least are extensions which ruin some inference.

Re: Dynamic Languages are Unmaintainable

#63
post #48

Earlier quoted context omitted.

Eh, you'll have an annoying time putting a man on the moon with that attitude. But hey, your twitters will hockeystick better! It all depends on your problem domain--the cost of failure for certain things (pacemakers, telco software, car engine ECU code, and so on) may be much, much greater than the cost of being super retentive in your development.

Yes, it depends on the domain but outside a few industries (and low-level code) software isn't a life-or-death matter. Infrastructure is a different kettle of fish, while it might sometimes be a life-or-death matter, generally it's just safer to seek pure robustness here: monopolies with government connections do not need to fear losing competitiveness since they can (a) manipulate the rules of the market, and (b) bi…

True indeed but the initial comment of 'It's better to do the wrong thing quickly.' was stated without nuance or caveat so the reply rightly pointed out that this statement is true in certain domains and completely false in others.

Re: Dynamic Languages are Unmaintainable

#64

Hey, you might not know this, but if you use a dynamic language with types you can actually use them to your benefit! I've wrote a system in ruby that does clean type checking when I want it to and it cleans up the code and tests a lot. Just because you're not taking full advantage of your language tools doesn't mean that "dynamic languages are unmaintainable"

How can you implement a static typing system in a language that is dynamically typed?

You can't. You can use type inspection and assertions to clearly delimit borders in your code, but it's really not the same thing.

Re: Dynamic Languages are Unmaintainable

#65
post #56

Earlier quoted context omitted.

>> don't have to write any tests at all That is, until you find out that your state-machine matches incorrectly on an input text file... >> maintenance is easy. ...and you are the only person your company can find to maintain your codebase. You're zero for two, my friend. :(

> ...and you are the only person your company can find to maintain your codebase. Why should this be? Plenty of companies have teams of functional programmers.

Are you in the Valley or New York, by any chance?

No reason.

Re: Dynamic Languages are Unmaintainable

#66

Hey, you might not know this, but if you use a dynamic language with types you can actually use them to your benefit! I've wrote a system in ruby that does clean type checking when I want it to and it cleans up the code and tests a lot. Just because you're not taking full advantage of your language tools doesn't mean that "dynamic languages are unmaintainable"

How can you implement a static typing system in a language that is dynamically typed?

There is a difference between static typing and strong typing. Ruby is a dynamic language that is strongly typed. This will explain it better than I can:

http://www.rubyfleebie.com/ruby-is-dynamically-and-strongly-...

Re: Dynamic Languages are Unmaintainable

#68
post #42

Earlier quoted context omitted.

> when you've been running a long old calculation for 20 minutes and it chokes on a misspelled variable name. If you are writing C++, you can't hot edit and continue without re-compilation. With a scripting language and proper flow control, you can edit upon exception and resume.

> you can't hot edit and continue without re-compilation But with recompilation you can. watcom allowed stepping back during debugging as long as the operation was possible to revert. From there patching up the code to include a new version of the function shouldn't be that hard. Not sure if anyone's actually done it, but it's certainly not impossible. Ksplice works similar way if I'm not mistaken to do reboot-less k…

Ksplice is basically a binary (in ELF format) swap in kernel memory space.

What happens if your binary is faulty?

Re: Dynamic Languages are Unmaintainable

#69

Are so many bugs really caused by type problems? I run into type based errors in Python almost never. It is not hard to keep track of dynamic types, and takes the same effort (or less) than static typed programming. In both cases, you have to know what type you are working with, right? If you have this problem you have probably been trained to be sloppy by compilers.

I often get burned by doing something like `key = "player" + playerId`. Unfortunately, playerId is an int, and I forget that even though most other languages besides C/C++ will convert that for me, Python will not, so I get a runtime exception. Same thing with `print "no space after this" + number`, because I get used to `print "space after this", number` and then sometimes I don't want the space and inevitably I forget to do `str(number)`.

Mind you, this is the sort of thing you usually discover quickly, but it's also the sort of thing that most other languages will catch at compile time.

Re: Dynamic Languages are Unmaintainable

#70

Bad programming practices (which usually come from the business, in the form of unreasonable deadlines, untrained or unskilled programmers given high positions, and politically mandatory use of terrible legacy systems) are unmaintainable. I've seen static typing fall down just as hard when the developers weren't good. Static typing is right for some problems, but the idea that dynamic languages are inherently unmaint…

Compiler does help with a lot of things that you'd require unit tests for with a dynamic language.

Example: Runtime wouldn't be able to give you a protocol between how two classes would communicate. Say your service object that handles authentication. You would have to write unit tests so the two classes involved would know how to respond to each other.

Post reply on HN