Live data from Hacker News

Trying new programming languages helped me grow as a software engineer

cichocinski.dev

121–130 of 192 posts

Re: Trying new programming languages helped me grow as a software engineer

#121
What grew me the most as a programmer was doing the Advent of Code challenge every year using a different language each year (and doing 1 year with 3 languages each day). Learned so many new algorithms and languages I never would’ve otherwise encountered. Side note, Advent of Code 2022 starts December 1!

Re: Trying new programming languages helped me grow as a software engineer

#123

Probably the best is learning null-safe types and why it is important for basic hygiene. When you don't learn elementary type-safety, you create languages like Java and Go which are plagued with NullPointerException's and nil panics. So please, learn an ML (and a Lisp).

"null-safe type" is a term which takes the perspective of backpedaling out of a mistake, which keeps highlighting the mistake. The mistake is unnecessary in the first place; types do not naturally have a null in them that has to be exorcised.

For instance, when we think of a type like "the natural numbers", that's just a set of 1, 2, 3, ... there is no "null reference to Integer" in there.

Thus I think terms like "null-safe type" is just something we should leave to Java programmers, and not use as a way to talk about types.

Re: Trying new programming languages helped me grow as a software engineer

#124

Earlier quoted context omitted.

I think this is my first post on HN, but have been a long time lurker. That aside. Your point around ecosystems is interesting to me. As a wannabee coder I'm always trying new things. Most of my code was in PowerShell although I did do a bit of C++ and Delphi in school. I have been dabbling with dotnet core (C#) and Python the last couple of years. I tried to get into Java a bit, but to be frank the learning curve to…

You sound like you'd enjoy TypeScript with NodeJS. Low learning curve. Highly productive. Massively versatile ecosystem. You can be functional or OO. And of course, the type system, which will feel similar to C#. It's very fast and obviously JS being the language of the web is a natural benefit too.

For starting with TypeScript today, I’d almost certainly recommend trying Deno before Node. It’s much closer to standard web APIs, the tooling story is “you don’t need any until you know you do”. And it doesn’t have a zillion footguns like CJS/ESM interop, or different stream APIs, or complex package.json configs.

Re: Trying new programming languages helped me grow as a software engineer

#125
post #94
post #52

Different languages also have their own culture and ecosystem, which are also valuable to learn in order to get a different perspective. Some things that are taken as best practices are bad practices in other langauges and vice versa. For example, lots of Java devs are against early and multiple returns to the point of absurdity, while in functional languages this is idiomatic and no problem at all. Using different l…

"For example, lots of Java devs are against early and multiple returns to the point of absurdity, while in functional languages this is idiomatic and no problem at all." Which functional language are you talking about? Of the two functional languages I know, Elm can only have a single return statement. Scala encourages a single return.

In a functional language technically you don’t have multiple returns, because the function is a single expression so in a way you’re right. On the other hand the actual result of the expression is determined on a leaf of the expression so you could consider it a return point

To make an example the following expression can be considered to have two returns:

    max x y =
      if x > y
      then x
      else y

The Java equivalent is

    int max(int x,int y) { 
      if (x>y) 
        return x;
      else 
        return y;
   }

Some people abhor the idea of having multiple returns in a method, and say that you should write it like

    int max(int x, int y) {
      int result;
      if (x>y) 
        result = x;
      else 
        result = y;
      return result;
    }
(Disclaimer: Contrived and buggy example as I am on mobile)

Re: Trying new programming languages helped me grow as a software engineer

#126
Learning different programming languages definitely helped expose me to new ideas, but I think it's a relatively shallow way to grow. There's only a few that I think are really worth learning for the sake of personal growth:

- both C and C++

- Some form of lisp. I could see julia taking this spot.

- Haskell

- SQL

There are obviously more that are worth learning for industrial use. Learning the above will give a solid understanding of how every other language works though, even if there's different semantics for a particular language.

When I was really into learning new languages, I think it was because I didn't have a good sense of how to do more challenging things.

At some point, I settled down and got more into projects that really require more domain knowledge. Writing an external merge sort, interpreter & compiler, a gameboy emulator, a disk persisted b+tree, ray tracing & physically based rendering, etc.

Those types of problems are what really pushed my boundaries and made me think more about how to solve problems. In the case of ray tracing & pbr, it forced me to learn some calculus, linear algebra, and statistics, which has been an incredibly rewarding experience.

It can be fun to imagine what solving a problem looks like in a language, because it may have some qualities that play to the strengths of a solution. At the end of the day, the languages are just tools people have come up with. Learning the quirks of C++ becomes less fun when you start to realize that it is the way it is because of how history unfolded rather than because of some interesting concept.

(edit: hn list formatting)

Re: Trying new programming languages helped me grow as a software engineer

#127
> Because of some of my programming teachers, I had a feeling that JavaScript is not a “real” programming language. In addition, it was JavaScript in the frontend environment, so you know, moving divs and buttons around, not algorithms.

Well, it certainly does not live up to the standards of languages, which those people would call "real programming languages". So while they are doing a true scotchman thing there, there is also some truth at the core of it. If we remember JS how it was a decade or more ago, and what JS today still keeps downwards-compatibility with, it is easy to see, how the very foundations are flawed, to say the least. Self-respecting computer scientists, professors or not, will most likely not accept those shaky foundations as something worthy.

Anyway, it is not the pure count of programming languages, but rather the count of programming language families one got to know, that makes the difference. If all one ever touches are languages out of the algol family, then it will have far far less benefit, compared to trying out languages from various families. For example one will learn much more, trying out SQL, a lisp, an APL, Prolog and a Smalltalk dialect, a language with stytic typing and a langauge with dynamic typing, than from trying out Java, C++ and C# and the like.

This is because the various different families do things vastly differently and require you to switch your brain into different modes, while languages of the same family will mostly only make you learn a new syntax and new built-in function names.

Re: Trying new programming languages helped me grow as a software engineer

#128

For my personal case, I found out that writing "real programs" in anything else than assembly with a conservative usage of a macro processor is kind of toxic: it is a complex matter based on my experience and what I could understand from "software history". A high level script language would be such "real program". Idem for a command shell. risc-v, if successfull, will help a lot to this then remove a lot of what I c…

Are you actually saying all programs should be written in a macro assembly language? Tied to only one hardware platform, with high level concepts completely obfuscated by the need to express them in assembly? So when MS wants to make an ARM version of Windows, rewrite! When Apple switched from 68k to Power to x86/x64 to ARM, rewrite! Port the Linux kernel to a new platform, rewrite! Port the unix utilities to a new p…

That's why I cited risc-v. Standard of interoperabitily at the assembly level.

Yes, and porting from 1 assembly to another is easy.

Re: Trying new programming languages helped me grow as a software engineer

#129
post #52

Different languages also have their own culture and ecosystem, which are also valuable to learn in order to get a different perspective. Some things that are taken as best practices are bad practices in other langauges and vice versa. For example, lots of Java devs are against early and multiple returns to the point of absurdity, while in functional languages this is idiomatic and no problem at all. Using different l…

Rust convinced me that having a section at the top of a function that early returns in error/exceptional situations works very well. I find myself missing this in the one functional language I've tried, Elixir, although I find Elixir worth it for other reasons.

I initially fell in love with the Rust convention of simply bubbling up errors throughout a function but I've gradually realized that leads to a poor API. [1]

I'm currently learning c++ for a personal project. I want to use a library with an API that's sufficiently templated it'll be easier to write a c++ shim than directly generating bindings. So far I'm at the stage where I'm constantly thinking Rust does things better. Hopefully later on I'll realize why the different tradeoffs c++ makes make sense. (One example would be how generic code is typechecked).

[1]: If you want to be able to simply propagate up errors with the `?` operator you need to implement automatic conversations from your dependencies' errors to your error type. But that means your API will have a single error type for every dependency error type - say MyError::Io(io::Error) - which is the wrong level of specificity. I now think you should either expose only a string message your user can just show their end user or an error that's much more specific so they can write code that intelligently responds to it. Something like MyError::ReadConfigFailed(io::Error)

Re: Trying new programming languages helped me grow as a software engineer

#130

For my personal case, I found out that writing "real programs" in anything else than assembly with a conservative usage of a macro processor is kind of toxic: it is a complex matter based on my experience and what I could understand from "software history". A high level script language would be such "real program". Idem for a command shell. risc-v, if successfull, will help a lot to this then remove a lot of what I c…

Why do you think so? I assume that writing the same piece of code in assembly would take more than twice as long (conservative estimate) if you do the same in high level languages without much benefit. Can you elaborate your opinion a bit more as I am curious. I have been wanting to get into learning assembly but just cant seem to do it as high level languages are so easy to code in and want to know if anyone really…

You are perfectly right. Basically, it is "moving the lines".

Taking more time to code, even duplicate some code paths for major ISAs is saner than to depend on the planned obsolescence of grotesquely and absurdely massive compilers and many computer language syntaxes. See that as short term thinking vs long term thinking.

You would find some kind of middle ground when combining those with high level scripting languages.

Think about a world where many code paths are available in risc-v assembly, with risc-v written python-like interpreters.

Post reply on HN