It is really different feelings. When I am writing the C code it forces me to must think about data structure at first time. But when I write C++/Java I always think about abstraction and behavior (methods) as starting point.
Once upon a time and even today I like C++/Java thinking style very much and abstract class and behavior and make general OOP design.
But as time go when I deal with some really complicated problems I am aware of like a lot of expert said data structure is much more important than abstraction, behavior or algorithm. Especially recently I am reading source code of Lua and Redis I am so surprised these C code is amazing. And also I put myself to think if I am author how I can start and implement them as C++/Java programmer. A lot of abstraction and a lot of methods fill in my minds immediately I am almost lost and I can’t find a easy starting point although there are so much methodologies about OOD. Maybe I can write pretty much code at abstract level such as
VirtureMachine interface including
execute abstract methods but I know it’s nothing. I will take a lot of time to think about non-meaningful code, I am escaping from the most difficult part, like this.
As another simple example with pretty much circumstances we hope a method execution running with a specific context or container. When I use C++/Java it is pretty obviously that I provide a
Context interface and inject to domain object and at this time I haven’t known anything about Context details and I just put everything, in general a lot of geXXX() methods other service methods which I need get from Context. Everything is good.
But when I suppose I am a C programmer it seems becoming different. I have to think about its internal implementation and carefully design structure and a series methods on it and also these methods sequence dependency such as init method must be called before other methods. At this time possibly you will said structure is just like a class only containing data you can do same thing with OO language but it is different as OOD it is abnormal that a class not containing methods. And OOD always firstly emphasize behavior’s importance.
But with a lot of circumstance data structure is much more important than behavior and abstraction. It is so directly to focus the core problems and avoid bad taste of over-design and it seems impossible that C program has over-design problem, and it decide how you start any other things. Around data structure to design system is always a tradition of unix/linux C programmers. It is not easy to master and I think that’s why OOD is so popular you are always able to start writing something even you are not clear how to implement it.
A good C programmer either can not start programming at all without data structure or resolve problem smoothly and almost perfectly around the several data structure.
As a Java programmer it take so many times to design abstraction and carefully use all kinds of design patterns to generate tons of code but the problem is still there. Refactoring and redesign almost distribute the whole development life cycle.