Live data from Hacker News

Ask HN: If I only learn one static typed language, which one should I learn?

news.ycombinator.com

51–60 of 67 posts

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#51
post #31

Earlier quoted context omitted.

> They will teach you concepts you can take back into PHP or Node.js Curious what these are. The only thing I retain back in dynamically-typed land is "argh I wish this was statically typed!"

I've worked with functions in JavaScript that change functionality radically depending on whether you pass an integer or an object. I thought this was the way of the world until I got deeper into typed languages, where you learn why not doing that is good. Type envy still stings though.

> I've worked with functions in JavaScript that change functionality radically depending on whether you pass an integer or an object. > I thought this was the way of the world until I got deeper into typed languages, where you learn why not doing that is good. Type envy still stings though.

This is just polymorphism, isn't it? Why is this not a good thing?

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#52

I am still facing dilemma Java vs C#. I have to say I like C# more but there seems to be many more Java jobs than C#.

There are so many jobs in both of them that if you're having trouble getting hired, you probably should learn a little bit more.

Right. But location matters and in smaller parts of the world it is difficult to be picky.

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#53

Earlier quoted context omitted.

I've worked with functions in JavaScript that change functionality radically depending on whether you pass an integer or an object. I thought this was the way of the world until I got deeper into typed languages, where you learn why not doing that is good. Type envy still stings though.

> I've worked with functions in JavaScript that change functionality radically depending on whether you pass an integer or an object. > I thought this was the way of the world until I got deeper into typed languages, where you learn why not doing that is good. Type envy still stings though. This is just polymorphism, isn't it? Why is this not a good thing?

In small doses it's fine, but 2000 line functions whose branches have nothing to do with each other is hard to fit in one's head.

The great thing about statically-typed languages is that they help you write your software instead of giving you a blowtorch and saying "have fun". I know a lot of people find that a bit patronizing, but I'm not one to turn down help (especially from a bot that won't call me on it later).

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#54
A lot of people here say C#. Well, that is a decent option, but I think F# is overall better (however, obviously C# have a bigger job market).

F# is similar to oCalm, still can do the things C# do, still you can use C#, still you are using .NET.

That is a lot of plus!

The main downside is the smaller job market.

----

BTW if you use PHP/JS, C# will not teach you much. Is also "OO" and much code around, specially old or coming from the corporate world is not eye opener.

PHP/Js are less well designed languages, that encourage and celebrate bad practices... but most decent developers learn to workaround that and coming to other languages will look at first like "same".

Require some study and effort to see how much C# is better.

In contrast, F#, Pascal, oCalm, Haskell, Rust, etc will open your mind and increase your skills, because will move you out the comfort zone.

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#55
post #31

OCaml or Haskell. They will teach you concepts you can take back into PHP or Node.js to make your code better. And in my frank, unbiased opinion: sound type systems and pure functional programming is the future of the industry. If you're a pragmatist it's still a good choice. You can bring FP concepts to C, Java, whatever later on too.

> They will teach you concepts you can take back into PHP or Node.js Curious what these are. The only thing I retain back in dynamically-typed land is "argh I wish this was statically typed!"

A monad is a mathematical abstraction. There's nothing special about Haskell that makes it work with monads. They work great in Javascript, C, Python... the syntax of those languages don't make it terribly easy to work with them but it's still available. You have to be disciplined since you don't have the type system checking your work for you but you still get the benefits of the abstraction.

I'm presently trying to make this a little better in my own team's codebase by trying to introduce Flow [0]. There are a lack of definitions for the monadic libraries we use which I'm presently remedying. It's not pretty -- and my kingdom for OCaml or GHC! -- but it's better than not having it.

Knowing the fundamentals will help you learn to structure code and think clearly about abstractions. It's the difference between merely using something and understanding how it works. In the latter case you have the power to exploit it.

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#56
post #9

Practically speaking, Java or C#, purely for the job prospects. C / C++ if you're looking for something with wide applicability to learning other languages more quickly.

> C / C++ if you're looking for something with wide applicability to learning other languages more quickly. I came here looking for this. I learned C as my first language [1]. And I learned an immense amount about how things like memory management and type casting and things like that work. It is a foundation that has helped me learn other languages much more quickly. Although the question is for learning "only one"…

C was my first "real" language (BASIC was the one before it). I learned using the great C for Dummies by Dan Gookin[1], which at the time consisted of two massive volumes comprising over 1000 pages. Good times.

Nowadays most of my work is PHP and Node.js, but if you know C, you will have no problems learning PHP.

1. https://www.amazon.com/All-One-Desk-Reference-Dummies/dp/076...

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#57
post #56

Earlier quoted context omitted.

> C / C++ if you're looking for something with wide applicability to learning other languages more quickly. I came here looking for this. I learned C as my first language [1]. And I learned an immense amount about how things like memory management and type casting and things like that work. It is a foundation that has helped me learn other languages much more quickly. Although the question is for learning "only one"…

C was my first "real" language (BASIC was the one before it). I learned using the great C for Dummies by Dan Gookin[1], which at the time consisted of two massive volumes comprising over 1000 pages. Good times. Nowadays most of my work is PHP and Node.js, but if you know C, you will have no problems learning PHP. 1. https://www.amazon.com/All-One-Desk-Reference-Dummies/dp/076...

PHP is a very close cousin of C. Up until it became Object Oriented it was pretty much a cross between C and Perl.

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#58

Earlier quoted context omitted.

> I've worked with functions in JavaScript that change functionality radically depending on whether you pass an integer or an object. > I thought this was the way of the world until I got deeper into typed languages, where you learn why not doing that is good. Type envy still stings though. This is just polymorphism, isn't it? Why is this not a good thing?

In small doses it's fine, but 2000 line functions whose branches have nothing to do with each other is hard to fit in one's head. The great thing about statically-typed languages is that they help you write your software instead of giving you a blowtorch and saying "have fun". I know a lot of people find that a bit patronizing, but I'm not one to turn down help (especially from a bot that won't call me on it later).

I'm not sure I follow. I don't find "2000-line functions whose branches ..." to be a requirement for polymorphism.

I'm also not against static typing, but I am against thinking it's a silver bullet. Consider this: `function inc(x: number): number { return x - 1; }`. It passes the type checker, but the blow torch still burned you.

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#59
Practicality-wise, I'd suggest Javascript because you learn it once and you can use it for frontend (DOM, angular, react, etc) and backend (node.js), all of which are very popular and highly-demanded. For learning-wise, it's not the best language to learn about language concept though..

Re: Ask HN: If I only learn one static typed language, which one should I learn?

#60
post #31

Earlier quoted context omitted.

> They will teach you concepts you can take back into PHP or Node.js Curious what these are. The only thing I retain back in dynamically-typed land is "argh I wish this was statically typed!"

A monad is a mathematical abstraction. There's nothing special about Haskell that makes it work with monads. They work great in Javascript, C, Python... the syntax of those languages don't make it terribly easy to work with them but it's still available. You have to be disciplined since you don't have the type system checking your work for you but you still get the benefits of the abstraction. I'm presently trying to…

[deleted]
Post reply on HN