4 ms·
This is part of approach to programming that is more popular in functional world. You take requirements and make system exactly right to fit these requirements
by ajuc 6y ago
This is part of approach to programming that is more popular in functional world.
You take requirements and make system exactly right to fit these requirements perfectly and don't bother with any other concerns.
When you design this close to the requirements you get better, faster and more elegant code that's easier to understand - but when requirements change you have to do much more work to adapt. Suddenly a state which was previously invalid is valid, or a part of system that only needed one kind of input needs 4 different inputs from separate parts of your code. Have fun basically rewriting your program.
That's IMHO the main motivation between differences in functional and OO programming - how close to the requirements you want to design your code.
- pjmlp 6y agoThis kind of approach (type driven development) was already popular in Algol derived languages, hence why the cowboy coder would call us on Ada, Modula-2, Object Pascal side of the fence, programming with straitjacket.
- ajuc 6y agoI don't think it maps 1-1 with strong vs weak typing. C (very loosely typed language) code is usually pretty close to the requirements and very strongly typed functional languages (like Haskell) are often "make DSL and write the specification in it, then run it". Meanwhile object oriented languages often have pretty strong typesystems and cultures of using them extensively, but they also encourage designing with margin for changes (and thus using lots of layers of abstractions instead of just implementing the specification as elegantly as possible).