ihan normi koodi työ ukko

  • 3 Posts
  • 23 Comments
Joined 3 years ago
cake
Cake day: June 5th, 2023

help-circle


  • We always hear how great Rust is, but I’d be curious to know where it isn’t.

    • In any project that’s sufficiently advanced and written in any other language. You don’t simply do a rewrite of 100k+ LOC just because you want to use Rust.

    • Somewhere where you’d rather use a scripting language like Python. I.e., rapid prototyping or gluing together some infra components.

    • A situation where your team’s expertise is in some other language.

    • A situation where a library/framework is native/only available for a certain language.

    Few of these are strictly technical requirements. It’s obvious that you can use almost any language to do almost anything, including Rust, if that’s what you prefer. However, the context matters in the real world.

    All this being said, I wish I had a chance to write Rust professionally. It’s a neat language.






  • Well, bad code is bad code regardless of the paradigm. I’ve just had bad experiences rewriting some horrible OOP codebases and opted out to use as much functional style as C# allowed me to.

    The main problem, as I see it, is that OOP encourages unnecessary abstractions and inheritance. These should be used as little as possible, because they typically increase complexity and make code harder to read and untangle. As an example, I’ve seen people define interfaces that don’t essentially define anything.

    Another problem is that OOP encourages mutable member variables. It’s very annoying to try to understand code where class C inherits from class B that inherits from class C. Good luck debugging when the methods of C modify a variable declared in A in subtle ways.

    As an idea OOP is very appealing. When I was younger, I would be thrilled to start designing a class hierarchy and interfaces when encountering a new programming challenge. Now I just try to think how to make things as simple and modular as possible.

    Edit: of course bad functional code is also bad code. It’s also very annoying to try to understand code where functions pass badly named functions around as parameters and use 10 function compositions in a sequence.