5 ms·
Hello - I also worked with Java, Scala, Clojure, Groovy, C#, PHP, Ruby, Perl, Python, Javascript, PHP and C and have been playing with Rust, Haskell, F#, Erlang
by bad_user 12y ago
Hello - I also worked with Java, Scala, Clojure, Groovy, C#, PHP, Ruby, Perl, Python, Javascript, PHP and C and have been playing with Rust, Haskell, F#, Erlang and Scheme as well.
In my opinion it isn't just an easy context switch and the principles aren't necessarily similar between OOP languages and functional languages, or between dynamic or static languages.
Some things remain the same, but some things are different, like the design patterns used, the techniques, the libraries and tools available, the mentality as a whole. When picking a language, you're not picking just a bunch of syntax and type system rules, but the ecosystem around it as well. It takes me one or two weeks to learn the basics of a programming language (i.e. the point at which I'm actually able to start coding and solve problems), but it takes me a year or more to learn the ecosystem around it.
For example doing functional programming doesn't fly in a language like Java, even if you can (as painful as that may be), because then you're the odd duckling swimming against the tide and you can't do that if your peers aren't doing it as well or if the libraries you're using are working against you. LISPs are very FP, but the abstractions used in comparison to what people do in a static language like Haskell are very different - for example LISP people don't think in terms of monads or applicative functors and they do like wacky things like rules engines. Erlang's or Akka's actor model is also very different than any other model for dealing with concurrency, because even though the rules look simple at first, that "let it crash" mentality and the ability of actors to communicate across address spaces changes everything. Ruby's meta-programming is also very foreign to people accustomed to Java or Haskell. Scala looks familiar to Java developers starting out, but beginners shouldn't be fooled, because Scala in common use is actually closer to Haskell and combined with OOP it sort of makes it unique in the approaches used. FP developers in general tend to prefer doing things with FRP, rather than MVC. Etc, etc...
Of course, you also have families. Python and Ruby are very similar, in spite of the seemingly different mentalities of their communities and after learning one, then learning the other is barely worth it. Ditto for Java and C#, many people would argue that C# is the nicer language, but Java has the nicer ecosystem of libraries and on the whole developers barely have a reason to jump from one to the other.
I'm not sure if I have a point - I guess what I'm trying to say is that developers should expose themselves to different ways of approaching problems. And when you're learning a language, one should go past the superficial syntax differences to discover the goodies and that takes time.
- jghn 12y agoThe other day at work I was asked to describe what I look for when I look at a resume or screen a candidate. I said that one of the most important things to me was a demonstration of a breadth of knowledge and experience and that was more important to me than a depth of experience. The example I gave was along the lines of IMO it's better to have spent 10 years working with a variety of languages from a variety of paradigms on a variety of types of projects than to have spent 10 years becoming the super deep expert in a single thing. Why? Largely the reasons you cite. As trends change and technology changes, often times the person in the latter camp will struggle much more than the person in the former camp. Sure, the people in the latter camp are much more impressive in their little slice of the world but the person who has seen the proverbial world will often be able to adapt more quickly. I've also found that the person with a breadth of knowledge which spans these sorts of concepts can often use that experience to form outside the box solutions (in a good way) to sticky problems.
- eropple 12y agoHonestly? Part of why I sort of shrug and don't find any of these languages terribly different is that, most of the lessons that are surfaced in one language are applicable elsewhere. I strongly disagree with regards to the notion that Scala is closer to Haskell, I think the scalaz folks want it to be and I think not many people listen to them. Instead I think Scala is what Java should become and I find a lot of valuable lessons come from it when I'm writing Java, functionally and immutably. It's harder than in Scala, hard enough that I default to Scala when I have the choice, though with IDEA it's not that hard. (My C++ looks pretty functional and immutable too, and because everything lives on the stack or in unique_ptrs I find that it makes memory management a heck of a lot easier, too!) Or I write metaprogramming-heavy C# and Java, automating annoying or hard problems (and I do have reasons to use C#, because Java doesn't run in half the places I want it to!) with a lot of reflection because it makes sense to me. A lot of that comes from JavaScript and Ruby; the expression of it is different in a statically typed language, but to me it's the same kind of thinking. They're all programming languages. They emphasize different things. That doesn't mean that all those things can't be happily incorporated into whatever you're doing in whatever language if you're willing to put in the effort. I am, and I think it makes me write much better code because of it. Small sample size and all, but I've never had anybody complain that "your code isn't idiomatic", though I have had people say "I like that, I've never seen it before."