6

Every time I try and write C++ code, I end up getting annoyed with my approach and trying several different ways to structure my code before giving up and reverting to writing the exact logic I need in C.

It is most likely due to lack of experience with writing C++ programs, and one day I'm sure I will finally work out how to apply the right patterns at the right time and find it quicker and easier to write good code. But for now, I use C since it is very easy to bend into whatever shape I desire.

Comments
  • 0
    Before doing any sort of refactoring, ask yourself one question how many people will read your code?
    Company usually use tools like resharper, and have very specific rules on how to structure your code.
  • 1
    Are we talking pre C++11? It's a different world these days.
  • 0
    @sunfishcc At work when I do development its generally only myself and maybe one or two others that will look at the code. Mostly me though. We don't have specific rules in place for coding standards for the stuff I work on. I do try to comment my code well at the very least.
  • 0
    @Hastouki Just C++ in general. I've not used any of the new features. Actually I could extend this problem to any OO language, but its usually most apparent when I'm trying to use C-based APIs with C++ so try to wrap things in classes etc. I have less of that problem with scripting languages etc.
Add Comment