News for hackers. Stuff that matters.
Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by bluetomcat on Tuesday January 19, 2016 @04:25PM (#10934170)
From my experience, a statically-typed language also lets me think upfront about the structure of the data that a program will manipulate. Getting your data structured properly from the start would result in straightforward algorithms and less future refactoring, which is certainly more efficient than throwing away and rewriting code every few months.
Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by ianamartin on Tuesday January 19, 2016 @04:50PM (#10934361)
Absolutely this. Most programs are really all about data. I build my data structures first. Always. If someone can't tell me approximately what data I'm working with, I won't work on that project. Data first. Then the data drives an interface. When you have those two pieces of the puzzle figured out, then we can start designing the code that solves the problems needed to get the data from the source to the destination.

I'm sure there are domains I'm not experienced in where that Dev model doesn't work. Like games or embedded systems and stuff. But for building web applications or statistical platforms, that's my workflow because if you don't get the data right, you're fucked.

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by Terr_ on Tuesday January 19, 2016 @08:57PM (#10935545)
I think the data-first approach sometimes leads to a problem of: "We saw we could, but never asked if we should."

The particular scenario I have in mind relates to a company with an internal system for managing work from proposal to invoice. There was a lot of data there, but it was never exactly clear what parts are used by what processes, what rules are invariant, and aspects of it existed purely for historical reasons. Sometimes you could implement a feature for Important Manager #1 only to discover that Important Manager #2 doesn't want it to apply to his employees. Then you'd put in special-case-code, and the dance continued.

In a situation like that, I'd far rather focus first on what the goal and process should be, and then use that occasion to refactor the stored data to accurately represent the evolving model for "how we do business".

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by ianamartin on Wednesday January 20, 2016 @12:24PM (#10939659)
I have no words for how broken this is.

You don't refactor data. Data is. Refactor your code.

Data isn't a model for "how you do business."

Data should be a model for what is. How you do business is an interpretation of the underlying data.

I deeply disagree with your approach, but I hope to do so with respect.

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by Terr_ on Wednesday January 20, 2016 @07:51PM (#10942612)
I think you may be overstimating the quality of data I'm griping about. Some of the tables are mostly-unused metadata about optional key-value pairs stored in other tables. Some of the key-value pairs are queried constantly but still haven't become "real columns" because nobody wants to rock the boat.

So instead there are dozens of extra joins and queries going on, and looking at CREATE TABLE definitions helps you find only about 60% of the data-points you might be interested in. In some places entities are related not by a link-table or foreign-key, but by having a similar prefix in a text-value. (So WHERE clauses contain substring checks.)

I believe one of the many contributing causes is that people tried to store their data ASAP before they knew exactly how they wanted to use it, and then the next time they assure themselves the data is technically available without stopping to consider whether it's available in the right way.

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by kqr on Monday January 25, 2016 @05:54PM (#10970637)
I agree. The first question I ask is "What is the data?" and the second, just as important question, I ask is "How is it used?"
Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by mkozlows on Tuesday January 19, 2016 @04:28PM (#10934192)
Which is great, for projects where that kind of upfront waterfall design is sensible.

That's not most projects.

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by mannykannot on Tuesday January 19, 2016 @04:57PM (#10934402)
It has nothing to do with upfront waterfall design specifically. Making choices about how you represent information is an integral and unavoidable part of algorithm design at any level of detail.

There are no projects for which a certain amount of thinking before you write is ill-advised.

Re:The Unreasonable Effectiveness of Dynamic Typing for Prac... by lomnakkus on Tuesday January 19, 2016 @05:07PM (#10934479)
Indeed, and personally I find that having the types around also makes it much safer to do the inevitable rounds of refactoring once you figure out what you're really building. (Especially in a language like Haskell where most of the type information is actually inferred from context. It requires absolutely minimal type annotation.)

EDIT: Maybe it's just my bias, but it seems to me that most of the "dynamic" crowd just haven't tried a truly "agile"[1] statically typed language like Haskell or O'Caml.

[1] Hey, if they want to abuse the connotations of out-of-context words to describe the paradigm, so can I. :)