Live data from Hacker News

Dynamic Languages are Unmaintainable

williamedwardscoder.tumblr.com

21–30 of 71 posts

Re: Dynamic Languages are Unmaintainable

#21
post #19

>> And here is that insidious problem; all your unit tests have frozen the interaction of your components. They have copied the API of your components and distributed it all over your test code base. This is what I hate about the unit-test everything approach. There seems to be a class of developers recently that believe robustness is more important than anything else. Often speed bumps in changing API contracts is a…

It's better to do the wrong thing quickly.

Re: Dynamic Languages are Unmaintainable

#22
post #18

Earlier quoted context omitted.

Could you elaborate. Which claims are incorrect?

One example would be this: > If you misspell a variable [...], you discover this at run time. Ouch. CL-USER> (defun square (n) (* nn n)) ;; Ouch! nn isn't defined! ; in: DEFUN SQUARE ; (* NN N) ; ; caught WARNING: ; undefined variable: NN ; ; compilation unit finished ; Undefined variable: ; NN ; caught 1 WARNING condition SQUARE

It is true of other dynamic languages and there isn't any way to fix that.

Re: Dynamic Languages are Unmaintainable

#23
post #7

I use a strongly, statically typed functional language. Because my code has no mutable state, the type system of the program proves the program correct. So I don't have to write any tests at all and maintenance is easy.

Not sure if you're trolling or just don't understand what tests are actually supposed to test.

I'll bite. What are tests supposed to test?

Re: Dynamic Languages are Unmaintainable

#24
post #3

The argument between dynamic and static languages has gone one for years and there's been no conclusive answer that one is better than the other. People have written 500kloc C++ systems and they've written 500kloc of TCL.

Submitter here: Yes, and some of the claims are simply factually incorrect: the original work on refactoring OO programs was done in the context of Smalltalk, the code navigation we now have in IDEs was taken from Smalltalk (in fact, Eclipse started out as Visual Age Smalltalk) etc. So I find the post "debatable"...

I have used the old refactoring browser in VisualWorks. It was cool for its time. I's pathetic compared to modern refactoring tools for static-typed languages.

Re: Dynamic Languages are Unmaintainable

#25
post #18

Earlier quoted context omitted.

One example would be this: > If you misspell a variable [...], you discover this at run time. Ouch. CL-USER> (defun square (n) (* nn n)) ;; Ouch! nn isn't defined! ; in: DEFUN SQUARE ; (* NN N) ; ; caught WARNING: ; undefined variable: NN ; ; compilation unit finished ; Undefined variable: ; NN ; caught 1 WARNING condition SQUARE

It is true of other dynamic languages and there isn't any way to fix that.

Sorry, many dynamic languages prevent against this. For example:

    $ perl -Mstrict -E 'say $foo'
    Global symbol "$foo" requires explicit package name at -e line 1.
Also, his comment about properties on objects is very debatable, too. Ignoring that the term "property" is overloaded and not defined, since I use roles (see: http://www.slideshare.net/Ovid/inheritance-versus-roles-1799...), I find out at compile time if my classes are missing an attribute or method (actually it's composition time, but that's splitting a hair that most will never notice). In short, I don't get frantic 2AM phone calls about a batch process trying to call a non-existent method.

Re: Dynamic Languages are Unmaintainable

#26
One thing I've only come to appreciate during my professional development is that there are huge differences in the kinds of software people write and what's good in one scenario isn't necessarily good in another. A lot of people around here fall into the trap (myself included) of thinking that web programming is the entire universe of programming. That's not so, and the difference matters greatly.

If you're going to write a physics simulation, you're really going to benefit from some language features over others. I would argue that you especially benefit from static types because you control a lot of your stack and type checking can make your code very robust. On the other hand, if you're going to write a webapp, think about what you're doing: essentially slinging text around and taking random inpust from users, casting all of it to actual types, and shoving it into a data store (casting it again sometimes). What is the type system providing you in that scenario? Everything is cast at runtime somewhere.

Re: Dynamic Languages are Unmaintainable

#27
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 unmaintainable in some way that most static languages aren't is one that I find incorrect.

Re: Dynamic Languages are Unmaintainable

#28
post #12

I use dynamically typed languages maybe 90% of the time, and completely agree. But here's the thing: for most projects - including ones in production - it doesn't matter because the app won't be large enough to not completely fit in a mental model. If the app starts getting too large, then by all means rewrite it in a statically typed language. If you're getting to that point, a rewrite is probably warranted anyways;…

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 able to be just as productive as with today's popular dynamic languages but get all the benefits of static verification.

Re: Dynamic Languages are Unmaintainable

#29
post #7

I use a strongly, statically typed functional language. Because my code has no mutable state, the type system of the program proves the program correct. So I don't have to write any tests at all and maintenance is easy.

As someone who uses strongly, statically typed functional languages (dependent ones like Coq no less), and who rarely writes unit tests, I downvoted you because you're wrong. Specifically:

> the type system of the program proves the program correct.

Is not a valid statement, unless you're actually writing proofs in Coq. I bet you aren't.

"The type system of the program proves many simple properties of the program correct" is much more correct.

Also:

> Because my code has no mutable state

No, that's not why. The type system you use may be incapable of reasoning about mutable state, which coincidentally serves to indicate that it most likely can't reason about such things as "this list is sorted", further supporting my initial counterpoint.

Check out ATS or Why for examples of languages that permit reasoning about mutable state.

Re: Dynamic Languages are Unmaintainable

#30
post #18

Earlier quoted context omitted.

One example would be this: > If you misspell a variable [...], you discover this at run time. Ouch. CL-USER> (defun square (n) (* nn n)) ;; Ouch! nn isn't defined! ; in: DEFUN SQUARE ; (* NN N) ; ; caught WARNING: ; undefined variable: NN ; ; compilation unit finished ; Undefined variable: ; NN ; caught 1 WARNING condition SQUARE

It is true of other dynamic languages and there isn't any way to fix that.

  $ cat err.py
  def a():
    print b
  $ pylint -E err.py
  ************* Module err
  E:  2,8:a: Undefined variable 'b'
Post reply on HN