C++ programming style

前端 未结 16 1685
眼角桃花
眼角桃花 2021-02-07 22:33

I\'m an old (but not too old) Java programmer, that decided to learn C++. But I have seen that much of C++ programming style, is... well, just damn ugly!

All that stuff

16条回答
  •  失恋的感觉
    2021-02-07 22:57

    Like a stereotypical programmer who programs in one specific paradigm, you decided that certain things that aren't familiar with you is just ugly.

    C++ is a different language, it's multiparadigm, and it has lots of carry-overs from C. As other have stated, that's just the way it is.

    Header files are there for the compiler to check basic syntax without knowing the implementation. If you're a heavy Java programmer, you should be fairly familiar with the whole program to an interface concept. Think of the header file is where the interface is.

    If you don't believe me, go look at some Mods out there for games. It's entirely possible to find the CryEngine2's header file somewhere because Crysis mods would need to talk to it, but it doesn't need to understand how it works. The header files will define how ultimately a calling function should setup the stack to call another function.

    Not to be condensending, but I think what you really need is to program in something completely different. Research other paradigms, and find some languages, and start writing some toy applications. At first, things would look ugly, but you'll eventually see the advantages.

    I said the same thing about functional programming too. Now I complain about how PHP butchered functional programming with arrays.

提交回复
热议问题