Could you guys give me advice on how to write good code?

(I'm mostly doing TypeScript and C++)

And what other languages should I learn?

  • 2
    „Good code“ is highly opinionated.

    TS/C++ is a solid combination, but I’m wondering why not C#?

    Otherwise, Python/Go is largely suggested here.
  • 3
    i recommend C# with .net core
  • 2
    @bagfox who suggests Python/Go?

    I think it’s an understatement that saying they are largerly suggested here is an overstatement...

    That said, what languages to learn wholly depends on where and what kind of applications you are looking to apply your craft, as well as wether you’re looking to learn a language for employability or because you want learning a lang to teach you a lot more than just the lang itself.
  • 2
    But I agree with @linus-torvald, the dotnet ecosystem might be worth to learn, C# for emplyoability, F# for learning a lot, lot more than just a great language.

    I also recommend Rust.
  • 0
    Go is best in term of formatting thanks to gofmt
  • 0
    I'd go for at least one jvm language, e.g. Kotlin or Scala.

    C# is also great for game development with Unity, if that's something for you.

    Python is a nice language, too, if you'd ask me, it gives you PEP as guidance for writing your code.

    I think Rust is a very interesting language to go for as well.

    Last but not least I'd include sth. functional for the completely different mindset/programming paradigm, e.g. Racket or Haskell
  • 4
    Asks how to write good code. Gets language suggestions because the answer would be too opinionated, as if the choice of language isn't more so. 🤦‍♂️

    My answer: make good abstractions that enable you to split functionality into modules where it's clear what the responsibilities are. If you do that well, it's clear what happens where and it's easy to replace and reuse parts of code.
  • 0
    @electrineer what he says.

    I person personally but experimented for some years on my own, listened to seniors at my jobs, listened to differing 'best practice' at different jobs, came to my own conclusions.

    Then I read Robert Martin's books, and Eric Evans DDD. It mostly reflected my own opinions gained through much thought and effort, and disagreeing with company seniors. And corrected some of my opinions.

    Tldr; my advice is listen to company seniors, but read books from industry seniors as a must.
  • 1
    People and their C# dotnet core stack evangelism…
    I’m riding the Microsoft career train! Toot toot! 🚂🤠

    You have a low level OOP and JavaScript with Typescript which is a solid combo. Pick a tool that you can use for work. Nobody can know everything in tech so the important thing is to learn something useful. That could be databases, network stack, Posix, CSS, devops tools, shell scripting, system admin, engineering, testing, or blah blah blah. The important thing is to use what you know because acquisition alone is both impossible and useless.

    What is going to be useful to you?
  • 1
    - follow the code standard
    - set up your tools to enforce it so you don't have to remember
    - practice
    - eat your own dogfood
  • 0
    Thank you all, i will try them
  • 0
    Rust and a functional programming language like Haskell for perspective.
  • 0
    I believe separation of concerns is an important one in code quality, modular reusable code, consistency,... Use a linter to enforce your code style.
  • 0
    @electrineer spot on answer! If you can do this you’re going to kick ass in this field
  • 0
    My billrate is too high for them 😋
Add Comment