Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualRavyne

Posted 25 December 2012 - 08:38 PM

To reinforce what Aardvajk said, its not that global state is a a better idea in C than C++, I think its more to the point that the mechanisms for encapsulation in C are not terribly obvious for less experienced programmers, and so many C codebases of smallish size kind of become this amorphous "pile of code" that has far less rigid structure than a typical C++ codebase of similar size. This lack of structure is bad, but it ends up seeming more able to cope with unforeseen changes as a result -- C code in this less-structured style is more fly-by-the-seat-of-your-pants hackable, while C++ tends to require at least a broad plan up-front, and departures from said plan can be done, but require a new plan. Good C code is the same way -- as a rule of thumb, odds are that if you make a significant change and didn't need a new plan as a result, its because you didn't have a plan to begin with.

 

There's also the issue that less-experienced C++ programmers tend to over use or misuse the OOP features of C++, deep inheritance hierarchies for example, or using inheritance where composition should be preferred.


#1Ravyne

Posted 25 December 2012 - 08:34 PM

To reinforce what Aardvajk said, its not that global state is a a better idea in C than C++, I think its more to the point that the mechanisms for encapsulation in C are not terribly obvious for less experienced programmers, and so many C codebases of smallish size kind of become this amorphous "pile of code" that has far less rigid structure than a typical C++ codebase of similar size. This lack of structure is bad, but it ends up seeming more able to cope with unforeseen changes as a result -- C code in this less-structured style is more fly-by-the-seat-of-your-pants hackable, while C++ tends to require at least a broad plan up-front, and departures from said plan can be done, but require a new plan.

 

There's also the issue that less-experienced C++ programmers tend to over use or misuse the OOP features of C++, deep inheritance hierarchies for example, or using inheritance where composition should be preferred.


PARTNERS