Live data from Hacker News

Study of 49 programmers: static type system had no effect on development time

cs.washington.edu

61–70 of 192 posts

Re: Study of 49 programmers: static type system had no effect on development time

#61
While interesting, I don't think we can consider the conclusion as the final word on it. There are many other variables to take in account.

The programmer's expertise is an important one and it is difficult to take in account. Static typing is to check code validity. If the programmers make no mistake, then of course specifying types is an overhead. When it comes to collaborative work, strong typing can save a lot of debugging time, meeting time and documentation writing and reading time.

Another aspect is the resulting code efficiency. Code is programmed once and executed many times. It is much easier for a compiler to generate efficient code when it is given more information to do so by the programmer. This benefit of the typing overhead is not taken in consideration.

As repeatedly said, use the appropriate tool for your application.

Re: Study of 49 programmers: static type system had no effect on development time

#62
If anything, I think this study is actually in favor of static typing. Why? Well, most of the proponents of dynamic typing claim it makes development faster. Most proponents of static typing concede this point, but claim that while it may slow down initial development, it makes maintenance much easier.

Of course, this study is fairly limited and drawing conclusions from it is probably premature. I would not base any policy decisions on it alone.

But, if static typing does not slow you down, it seems worth using even if benefits to maintainability are slight. And if they're nonexistent, using a statically typed language over a dynamically typed one still doesn't hurt you.

Besides, I think static typing is awesome. And I'm a college student--you can trust me! That should be all the validation you need :).

Re: Study of 49 programmers: static type system had no effect on development time

#64

The study may or may not be flawed, but what's really interesting to me is the reaction. We need more science in our computer science, which means more experiments and more results like this. We should also be open to the truth that we use the tools we like because we like them rather than because they're technically superior, even though we pimp them ad nauseum as though they are. I once read an article about a tech…

I don't know how science can help you here. In the case of the improved fan design, well that's easily testable.

However, I don't want to go down the rabbit hole and argue social vs natural sciences.

I find it dumbfounding that in this day and age, people can still create rather arbitrary social experiments with only 49 people and then think they can draw grandiose conclusions from their "data".

Re: Study of 49 programmers: static type system had no effect on development time

#65
post #41

Development time with static languages is not an issue. Try comparing the time one needs to change the codebase written in ML and the one written in Lisp and come back. It is experimentation and change that is slow in static typing.

"It is experimentation and change that is slow in static typing."

It's all about the expressiveness of the language. If you can express more with less code, than it's also easier to change, to experiment.

If you change something in a dynamically typed language you still have to catch all places, where the change has consequences.

Only If you want to experiment with something locally without needing to update the rest of the code base, than dynamic typing has an advantage.

I think it's GHC 7.4, which allows something similar for Haskell, to have the typing checked at runtime, to allow this kind of experimentation.

I think that's the best of both worlds, because for the production code you can still activate the compile time type checking.

Re: Study of 49 programmers: static type system had no effect on development time

#66
I'm still torn between dynamic and static typing.

The main disadvantage of dynamic typing for me is the lack of verifiable documentation about what data a function needs, and which data comes out of it. This becomes a problem when

a) the data is complex (e.g. dictionary of lists of items with certain properties)

b) I haven't looked at the function for a while.

In those cases, I find statically typed code easier to reason about.

On the other hand, it absolutely maddens me that static type systems force me to spell everything out, even where it's trivial. It slows me down, it bloats the code (especially when you have to create a new class for everything) - which again makes it harder to see the purpose of the code instantly.

That's why I decided to make my own little pragmatic experiment: In cases where complexity is expected (or experienced) - and only there- I use the Clojure pre- and post-conditions to check the shape of selected parameters and/or its return value. It looks like this:

(defn german-holidays

  "Returns map of german holidays, in the year of d."

  [d]

    {:post [(like {(date 1 1 2012) :easter} %)]}

   ...)
(defn calendar

  [c start-date end-date]

  {:pre [(like {:appointments {} :new (list)} c)]

   :post [(like {(today) {:occupations [] :appointments 
#{}}} %)]}

   ...)
You can instantly see how the data is supposed to look like, it will be checked automatically, and it is close to the actual code where you need it (unlike e.g. Unit Tests).

I'm not yet sure how this experiment will fare in the future, so any suggestions or warnings are appreciated.

Re: Study of 49 programmers: static type system had no effect on development time

#67
No negative effect of static type systems for green field development sounds great to me.

I do like static type systems (like Scala) more than dynamic ones (like Ruby), and always thought it would perhaps people slow down. Good to hear it doesn't.

One would need to look into brown field development, if there is any positive/negative effects (I assume positive ones)

Re: Study of 49 programmers: static type system had no effect on development time

#68
post #65
post #41

Development time with static languages is not an issue. Try comparing the time one needs to change the codebase written in ML and the one written in Lisp and come back. It is experimentation and change that is slow in static typing.

"It is experimentation and change that is slow in static typing." It's all about the expressiveness of the language. If you can express more with less code, than it's also easier to change, to experiment. If you change something in a dynamically typed language you still have to catch all places, where the change has consequences. Only If you want to experiment with something locally without needing to update the rest…

"I think it's GHC 7.4, which allows something similar for Haskell, to have the typing checked at runtime, to allow this kind of experimentation."

It will be in GHC 7.6.1 and the extension is '-XDelayErrors'.

http://hackage.haskell.org/trac/ghc/ticket/5624 http://hackage.haskell.org/trac/ghc/wiki/DeferErrorsToRuntim...

Re: Study of 49 programmers: static type system had no effect on development time

#69

I've wondered about languages that are "hybrid" in the sense that the type system can be turned on and off, because from an intuitive sense, whether the language is meant to be used as a dynamic language has an impact on its design, similarly with a static language. You take Smalltalk for example, as it is the original archetype of a language that benefit from blurring the lines of the type system. A language like Ha…

> the GHC Haskell compiler now allows you to treat type errors as warnings.

Explain? Or post a link?

EDIT: found it: http://hackage.haskell.org/trac/ghc/ticket/5624

Re: Study of 49 programmers: static type system had no effect on development time

#70

I'm still torn between dynamic and static typing. The main disadvantage of dynamic typing for me is the lack of verifiable documentation about what data a function needs, and which data comes out of it. This becomes a problem when a) the data is complex (e.g. dictionary of lists of items with certain properties) b) I haven't looked at the function for a while. In those cases, I find statically typed code easier to re…

I use tests for documentation. They seem like more work at the start, but they're more flexible. You can self-document things with tests that you cannot with just types.

For example, here are some tests from the lisp interpreter I've been working on: http://github.com/akkartik/wart/blob/8a8cf96816/030.test

You're right that tests aren't close to code. But that can be good or bad. Since it's not next to the code it can be more verbose and thorough without adding a constant reading burden. And when I wonder, "why is this line here?" I can comment it out and run the tests to find out.

I think of tests as records of the input space of my program. Most of the time we go to great lengths to make explicit what we do but not quite what aspects of its behavior we truly care about. Where are the dont-cares in this program? If I refactor it am I restricted to a bit-for-bit identical behavior? In practice that's impossible, and without tests we fudge random parts of the state space without rigorously knowing what is important and what isn't.

Post reply on HN