Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have difficulty handling the complexity of typical C code due to the lack of abstraction. C always winds up with huge functions and lots of hard to grasp state up in your face. C++ gives you way more opportunities to hide away complexity.



C always winds up with huge functions and lots of hard to grasp state up in your face.

That's something I've never found to be the case. Most of my C functions are 5-15 lines long. Anything more than 20 lines long is a candidate for refactoring - the unit tests will tell you if you've broken anything.


The solution to complexity is to eliminate it, not to hide it. You've nailed the big problem with C++ right there.


I really don't know what that means...


Think of it like this: Would you rather have an operating system that has a bunch of little ads in the corner by the clock that are periodically "hidden" under a chevron, or would you rather that the crap wasn't there in the first place?


Some complexity is inherent to the problem and you can't get rid of it. You can only manage it through abstractions.


Any good programmer can write good abstraction in any language--including C.

If your functions are huge, you should rethink your design, regardless of the language.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: