4 ms·
A few years ago I accidentally deleted my entire Haskell assignment about 1 day before it was due. Within a few hours I rebuilt it from scratch. That's when I
by shahbaby 7y ago
A few years ago I accidentally deleted my entire Haskell assignment about 1 day before it was due.
Within a few hours I rebuilt it from scratch.
That's when I realized the power of functional programming. There's no way I have been able to recover that quickly if I had used an imperative programming language.
Since that experience I've tried to follow a functional programming style whenever I can. I've realized that every variable is another state which adds to the complexity of the code.
- UncleMeat 7y agoBut it was a programming assignment. Building a thing fast is, outside of very few situations, not a thing to optimize for. Building something to be maintained and evolved over time by non rockstars is far far more important, IMO. Perl is great for ripping through some script quickly but it has problems for long term maintenance.
- yakshaving_jgt 7y agoBuilding a thing fast is absolutely something to optimise for in business. Time is money.
- shahbaby 7y agoActually outside of a programming assignment, I think maintenance rather than speed is precisely why a company would want a functional code base. How much time is wasted on debugging? Functional programming forces you to deal with your bugs at a much earlier point of development. It also forces you to avoid some bad practices just to meet a deadline. And since you're re-using so many component, you spend much less time with boiler plate code.
- sullyj3 7y agoIt's definitely possible to write "boring Haskell". getting fancy is more of a cultural tendency than a necessity when building things with Haskell. https://www.snoyman.com/blog/2019/11/boring-haskell-manifesto https://www.snoyman.com/blog/2019/11/boring-haskell-manifest...
- WorldMaker 7y agoThough the interesting point here was that it made it easy to write the program fast the second time. While it should be very rare you need to write exactly the same program a second time, and can be a useful thing (albeit a hard thing) to optimize a language for if in writing a program a first time in that language you wind up with such a clarity on the problems you encountered that "solving" them again a second time feels trivial.