Hacker News new | past | comments | ask | show | jobs | submit login

I understand my code - the language doesn't dictate the understandability of the code that is written. Any language can be used to write indecipherable bad code. You are blaming the wrong thing. C++ seems to be very widely used to write some amazing things, despite your apparent hatred of it?



Would you really say that this sort of complexity is just down to writing indecipherable bad code?

https://isocpp.org/blog/2012/11/universal-references-in-c11-...

In my view C++ is a very complex language that only few people can write safely and productively.

When you say "I understand my code" I have to believe you. The problem is that understanding other people's C++ code takes ages, even if they don't abuse the language. Trusting their code is another story entirely.

C++ is a very flexible language in that it puts few restrictions on redefining the meaning of any particular syntactic expression.

That's great, but it also means that there is a lot of non-local information that you have to be aware of in order to understand what any particular piece of code actually does.

I'm not surprised that C++ is both loved and hated and perhaps even more often simply accepted as the only practical choice.

There aren't many widely used languages around that allow us to optimize our code almost without limit and at the same time provide powerful abstraction facilities.

At the same time, there aren't many widely used languages around that make reading other people's code as difficult as C++ (even well written code) and come with a comparably long tail of accumulated historical baggage.


Yes universal references take a while to understand. I read Scott Meyer's book and the chapter dedicated to it took some getting used to, and note taking.

The language is dealing with some tricky concepts. To hide them or try to gloss over them would lead to writing virtual machines and bloated memory usage etc. in the style of C# / Java.

How else would you deal with movement of variables and when an rvalue becomes an lvalue inside a function?


Haskell, Common Lisp, Ada, Scala, OCaml, F# come to mind.

Even Java and C# are slowly getting down that path.

Languages get those features because they make sense and solve real production problems.


Most (I hesitate to say all) programmers understand their own code. The problem is usually that nobody else understands that code you wrote.

> Any language can be used to write indecipherable bad code. You are blaming the wrong thing. Some languages allow stupid things. Some even encourage it. So, no, languages can and should be blamed.


I have to maintain other people's code, people who have left the company and not commented it. It is horrible to do, but it is possible. It's even better if they wrote it in a logical way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: