|
You know what the difference between a C++(C#) programmer and a C programmer is?
C programmers have no class.
|
|
|
|
|
groan! I've not heard that in a long long time.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Smack the C programmer round the head until he understands that globals aren't really necessary in most OOPs designs, and both increase complexity, and reduce reliability.
Then smack him again for good luck.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Being a long time C developer myself, I can attest that any C programmer worth his salt can apply some OOP techniques to his code to make it more maintainable and reusable and also reducing complexity.
At the end of the day, there's a lot of buzzwords in this industry. But someone who's really talented can make their environment sing and work magic, regardless of the buzzword du jour.
Keep in mind, I got nothing against OOP.
Jeremy Falcon
|
|
|
|
|
I absolutely agree.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
I think it basically boils down to the personal interest. The bunch of scientists I've worked with, do C to its core , like cake walk. But they where so disinterested to learn design patterns or anything related to OO. As long as they got the job done with a LOONG land-slide-dump of code, they are happy. They were given a clear choice of writing C++ code , i.e Visual Studio / VC++ 6.0 . But just the file names would be named .cpp & they were all stuck with damned obfuscated C code in their own ways & was never a sign of change. I still remember the dreaded Length-of-the-array parameters in all the functions. They just pass a pointer & pass along the length info every where. Damn. They were even given a top class training in STL & all the juicy containers. You'll see the the top two - three functions use vector type containers and as they get deeper into the code, they fall back to the crude pointer code. & the 99 percent of the code is this deep-crude ones.
And so what we were doing? The job is to understand the obfuscated code and put that into right design patterns with C++. May be the scientists wanted us to have a job? Could be .
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
C++ arrived in my student days. Those of you who were born then may remember that it came as a preprocessor to a (or any) plain C compiler, so we had the opportunity to see how the C++ compiler laid out classes and inheritance and interfaces and overloading and whathaveyou.
During summer vactaion I was an intern with a computer company whose OS was still written in a low-level language, somewhere in the middle between C and assembler, with structured flow of execution, but all registers visible etc. The machines were a proprietary architecture, the language proprietary an the OS proprietary, so the company didn't really risk much loss of business by providing the source code to the OS - it couldn't be used on any other machine anyway.
So I studied the OS source, and in the driver architecture I found, to my surprise, more or less blueprints of what the C++ compiler might generate. There was classes and inheritance and instantiations and virtuals. I remarked this to the OS guys, but they knew nothing of "object oriented" - that's some academic stuff, isn't it? They wrote their (near) assembly level code that way because it made the system far more flexible, not because of somthing called OO...
My other experience in this area: My first programming education was in Pascal. It was taught in a very structured way: All functions/procedures operating on a certain RECORD type (that is struct, in C terms) were kept together, and their first argument was always an instance of the RECORD type. When OO came along, we embraced the RECORD definition and it functions with a CLASS statement and moved the first function argument ahead of the function name, with a dot inbetween. So we didn't really see the big point of OO... Well, overloading and inheritance was new, but OO was an evoulution, not a revolution, to us.
|
|
|
|
|
Unfortunately Fortran is dark forbidden magic. But with F2008 you can make a decent attempt at making something more maintainable than what happened in the dark ages.
|
|
|
|
|
OOD is seriously overrated. Separate your components with a good messaging framework and a module loader, and you'll find that there's little reason for:
- encapsulation within classes (as functionality is encapsulated in plug-in modules instead)
- Inheritance: want to change behavior, swap out the module
- Polymorphism: it's just a different message
And you'll find that what you end up with instead is a library of low level classes to support your architecture, but the application specific stuff is really rather OOD free.
So, the problem lies more in how poorly programmers implement the application rather than the methodology they use (globals or OOP).
Marc
|
|
|
|
|
I find buzzwords to be a security blanket for those who don't really know what they're doing in tech. As long as you can buzz buzz buzz the coolest, hippest stuff you're a genius!
Jeremy Falcon
|
|
|
|
|
I tried an agile waterfall sprint, but I tripped over the kanban, and then broke my leg in the scrum; the rest of my team now calls me: "loser."
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
You're a genius!
Jeremy Falcon
|
|
|
|
|
I know a guy who made a living doing that. Then I had to work on some of his code and it was all copy paste or libraries that he bought. Plus his his preferred framework was Visual Basic 6.
|
|
|
|
|
Marc - yup. I'm not a religious nut when it comes to OOD. I am a zealot when it comes to keeping things separate and more importantly - easily understood.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Marc Clifton wrote: encapsulation within classes (as functionality is encapsulated in plug-in
modules instead) A module has often more responsibilities than a class.
Marc Clifton wrote: Inheritance: want to change behavior, swap out the module That's a good one. If you want to change behaviour, just uninstall the current version and install the correct one.
Marc Clifton wrote: Polymorphism: it's just a different message A class is not a message.
Yes, I do love those long lists of method-signatures and global variables; at a certain point I started grouping the signatures and the globals that seemed to go together. Next, those blocks got decoupled from the app, and had to manage their own state, as opposed to having them depend on a global variable in the app.
OO is simply a structured way to set up stuff. Sometimes it gives an obvious advantage, and sometimes people just use them because they are told to and make stuff worse than without the structure.
..and while I agree that one can do without, as everything can be done in simple pieces of assembly that one calls, I still would not recommend in doing so.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
3. Polymorphism: it's just a different message
Polymorphism means you send the SAME message, but the consumer of the message performs differently.
In your jargon, plugin a different consumer module (or multiple consumer modules if you want) without changing the message producer. The message producer doesn't know and should not care.
|
|
|
|
|
englebart wrote: Polymorphism means you send the SAME message, but the consumer of the message performs differently.
Yup, my bad.
Marc
|
|
|
|
|
Marc Clifton wrote: So, the problem lies more in how poorly programmers implement the application rather than the methodology they use (globals or OOP).
To say it another way, an average programmer may be able to make a relatively decent implementation given the right tools, a good programmer will do so regardless of the tools and language and a poor programmer can make a mess of even the most structured and pristine of tools and languages. Which will you choose to be today?
|
|
|
|
|
Don't forget about...
DRY - Don't repeat yourself
SLAP - Single level of abstraction principle (single inheritance)
|
|
|
|
|
and the ever popular EMB
Eat more bacon...
|
|
|
|
|
R. Giskard Reventlov wrote: Eat more bacon.
Of course!! Even if it does not cause cancer. 
|
|
|
|
|
My singular problem with all things OOP and OOD is that nobody ever was able to truly, accurately, and adequately provide a written definition of what those words actually mean in a form that I could grasp upon first reading.
Brass tacks: you have to read a thousand pages, and ask hundreds of people, in order to grasp them. They can't put them into writing. Period.
Years later, it appears that OOP/OOD are, basically, throwing away all things structured.
There was a time when structured thought was considered to be a significant aspect of a certain branch of psychometry.
But of course, those people (psychometrists) are just bad people, trying to put labels on people to hurt them.
Yeah
Right
|
|
|
|
|
I found the OOP manual that came with Turbo Pascal 5.5 was very good. And thin too. I think I downloaded a PDF version recently.
|
|
|
|
|
OOP has only three pillars.
|
|
|
|
|
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|