Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"The fact is that functional idioms work badly in languages that don't have syntactic support for them."

Then don't use those idioms. Work with your language, not against it. Learning Haskell taught the author to be more conscientious with state. Good. But nobody wants to debug imperative/OO code written by somebody newly infatuated with Haskell* -- it's like when people study a foreign language in high school and start dropping little fragments of Spanish/French/Japanese/etc. into casual conversation all the time, oblivious to whether the people around them understand it.

One of the comments (by "tom") nails it:

One of the more potent reasons for learning other modus operandi in programming to keep you from building tolerance to the same assumptions.

Learning several unrelated languages will almost certainly make you a better programmer, but code that assumes everybody else you're working with has the same background as you will be difficult to maintain. The language you're working in is the foundation for your shared culture, so do your best to write idiomatically in that.

* I have been guilty of this.



Interesting. It also happens with people newly infatuated with OO, esp design patterns.

I think this is a natural phase of learning - when you first grasp a new concept, you use it everywhere; later, you use it where appropriate. Maybe the first phase is exploratory practice, to grasp its limitations. I'm sure there is a pithy expression for these two phases.

Anyone know it?

The first phase is like "To the man with a hammer, everything looks like a nail". It's also similar to Fred Brooks' "Second System Effect" http://en.wikipedia.org/wiki/The_Mythical_Man-Month#The_Seco... , where you try to learn from all the mistakes you made in the First System.

Children learning language will apparently learn and use plurals correctly - until they discover the abstraction that you can add "s" to make a plural. They then apply it everywhere, including the irregular plurals: mans, foots, tooths, mouses etc. (that last one may be legit these days, mouse having acquired a technical referent). Or even like that developmental stage of babies, where they try chewing everything they find.


Agreed. I think the point of learning multiple paradigms is so that you can recognize when idiomatic programming in your preferred (or employer-mandated) language is not the best way to get the job done--recognizing when it's time to write functional-style code in Python, OO-style code in Haskell, or whatever. But most of the time, you follow the grain of the language.


Absolutely. Some languages comfortably support several paradigms, of course (http://www.c2.com/cgi/wiki?MultiParadigmProgrammingLanguage).


I think any non-toy language needs to make it non-painful to program in several paradigms, but I'm not sure about the "comfortably" part; it's good for a langauge to be designed around a central paradigm that can work for most tasks and that the implementor can optimize for. So Python is OO and Haskell is functional, and there are many problems that you solve in an OO style when writing Python and a functional style when using Haskell, and that's OK. And every once in a while you need to write functional-style code in Python, or OO-style code in Haskell, and that's OK too. I'm OK, you're OK, we're all OK....




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: