C Board  

Go Back   C Board > Community Boards > General Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 11-27-2008, 12:17 PM   #1
Registered User
 
officedog's Avatar
 
Join Date: Oct 2008
Posts: 77
Advice on next steps - shifting to OOP

So far I have had reasonable success with learning C and openGL. My interest is in graphics mainly. I guess I will have to make the shift to learning an OOP language at some point soon. Although C++ would be an obvious choice, because I have a mac, the dominant language is Objective-C.

There are some clear advantages to going down the objC route (such as it is native language and the mac system is set up for this language), but I also see some problems. e.g. ObjC doesn't seem to have the same (excellent) support from communities such as this, fewer tutorials and the learning curve looks extremely steep from the articles I have seen (I have Aaron Hildegras book).

C++ on the other hand has more support and looks less complex to get started with, but is not the native mac language as far as I can tell.

My options I think are:
a) Stick it out with C because it can ultimately do everything that other languages can do
b) Start learning an OOP language
i) Go for C++ and then (possibly) graduate to ObjC
ii) Go straight for ObjC
c) Have a cup of tea

I'd appreciate any thoughts on this. In meantime, back to C I think...
officedog is offline   Reply With Quote
Old 11-27-2008, 12:32 PM   #2
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,819
Quote:
Although C++ would be an obvious choice, because I have a mac, the dominant language is Objective-C.
It is?

Object oriented principles are not about this language or that language. That comes down to a matter of semantics on how to implement this or that OOP pattern in the language. The principles remain the same. I would recommend reading up on design patterns in general and would not focus on any certain language. A book on UML would also be a good read.

Then once you understand the concepts you can choose which language you want to employ those concepts in.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Old 11-27-2008, 12:55 PM   #3
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
Quote:
It is?
Yeah, the Cacao API is an Objective-C API.


Now, I've never actually used ObjC, not having a mac, so the following opinion is based on just a few tutorials and may be extremely unfairly prejudiced, but I think Objective-C is an absurd language. It's C, with some weakly typed, extremely foreign syntax tacked on to support object-orientation that's somewhere between Smalltalk and stricter OO languages.
__________________
All the buzzt!
CornedBee

"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
CornedBee is offline   Reply With Quote
Old 11-27-2008, 04:27 PM   #4
Registered User
 
officedog's Avatar
 
Join Date: Oct 2008
Posts: 77
Thanks for suggestions Bubba. Had a look at UML - I'll have to think more on this, I can see it's useful for organising/structuring the overall program. I suppose the basic issue I face at the moment is that with some earlier help here I've started trying to implement an "oop" style using C structs and function pointers. It's great, it works, but what a lot of typing... leading me to this question!

And thanks CornedBee - your comments mirror my thoughts about the learning curve. Makes me think I may be best sticking with C for now and return to this question later.
officedog is offline   Reply With Quote
Old 11-28-2008, 04:39 AM   #5
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
Quote:
Originally Posted by officedog View Post
a) Stick it out with C because it can ultimately do everything that other languages can do
No, it cannot. It's very weak in that area.

Quote:
b) Start learning an OOP language
i) Go for C++ and then (possibly) graduate to ObjC
ii) Go straight for ObjC
Well, this is just me, but I would definitely go straight for C++, and not look back at (Obj)C.

Quote:
c) Have a cup of tea
That sounds like a wonderful idea too

But honestly, if you are going to be writing anything like computer software or games, then you really should use a modern language. C is not a modern language, nor is ObjC.
The preferred language for games is C++ mainly due to its speed and its modern features that can even give modern languages a real challenge.

C is good for embedded projects where requirements aren't high, but for other projects, I would really recommend a moder modern language.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-28-2008, 04:56 AM   #6
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,297
> No, it cannot. It's very weak in that area.
Sure it can. Just that more and more 3rd party libraries seem to be moving to OO, and hence C++.

I'd say go for C++, but still keep knowledge and use of C. You never know!

I don't know what a modern language is!? But C is procedural, the idea of OOP is (fairly) modern. C and C++ are (very) roughly from the same era. If you want truly modern, then you should be looking at something a bit more managed. Choose the tool for the job, that doesn't mean the newest tool in the shop either.

I see no problem with maintaining 2 or more types of programming paradigms being procedural and object orientated. It could even make you more employable!

I myself know very little C++ (being syntax and keywords -- but I do have a "good" understanding of OOP), instead I doodle with C and Java. I do plan to make more use of C++ once I have a fairly large C project completed. That way I'll have something to show on my resume :-)

> The preferred language for games is C++
Careful! The big troll is pushing C# something wicked.

PS: UML is wonderful, defiantly worth the effort. Although it does suffer from a few flaws.

Did you end up trying GLFW officedog?
__________________
"I.T. gets the chicky-babes" - M. Kelly
bakefile | vim
zacs7 is online now   Reply With Quote
Old 11-28-2008, 04:58 AM   #7
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
Quote:
Originally Posted by zacs7 View Post
> No, it cannot. It's very weak in that area.
Sure it can. Just that more and more 3rd party libraries seem to be moving to OO, and hence C++.
Well, not in terms of libraries - but in terms of paradigms and features.
No classes, hence no RAII, smart pointers, etc.
No template support - so no type-safe or powerful ways of creating generic code, etc.

Libraries can always be found, of course...
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-28-2008, 08:25 AM   #8
The Right Honourable
 
psychopath's Avatar
 
Join Date: Mar 2004
Location: Where circles begin.
Posts: 1,068
Personally, I would learn C++, and use Obj-C++ for any Cocoa/GUI stuff (unless you insist on using Carbon). The syntax (among other things) is a little weird at first, but I didn't find it to hard to pick up on. Pretty much like learning any other language.

EDIT: Post #1000!
__________________
Memorial University of Newfoundland
Computer Science

Mac and OpenGL evangelist.
psychopath is offline   Reply With Quote
Old 11-28-2008, 09:05 AM   #9
Reverse Engineer
 
maxorator's Avatar
 
Join Date: Aug 2005
Location: Estonia
Posts: 2,260
Quote:
Originally Posted by Elysia View Post
Well, not in terms of libraries - but in terms of paradigms and features.
No classes, hence no RAII, smart pointers, etc.
No template support - so no type-safe or powerful ways of creating generic code, etc.

Libraries can always be found, of course...
Those are not things that can be done. Those are the methods how to do things. In C you just do them differently. I don't consider one of them to be better than the other - they're equal and both of them are useful to some people. You are just used to C++ features, C programmers are used to different features. It's like whining that gasoline cars don't run on diesel (but hey, both of them help the car move!).

To OP - you should definitely learn C++ since it's the most widely used portable programming language.
__________________
The duck is irrelevant to my point.

Last edited by maxorator; 11-28-2008 at 10:27 AM.
maxorator is offline   Reply With Quote
Old 11-28-2008, 11:47 AM   #10
Registered User
 
officedog's Avatar
 
Join Date: Oct 2008
Posts: 77
hi zacs7 - thanks for comments on this. Sadly I was unable to get GLFW working on the system and was too wrapped up with the GUI project to tackle how to get it loaded up. So... GLUT is still the thing I know. I'll have to sort this out soon as it looked very nice. I might just experiment with one of the GUI libraries provided automatically within the apple's developer package and see where that goes.

psychopath - thanks for that reassuring comment. I think the problem I had was that objC is so closely linked up with all the NSObjects and wotnot and also trying to figure out how to work with XCode - I had difficulty breaking the learning into simpler steps. In the end I came back to creating simple command line "standard tool" programs in C and built up openGL on top of that - which has been very successful so far. I guess your solution might be one to keep in mind for later if I want to work off the foundation and appkit libraries, but I'll need a little more learning before I get there.

Thanks Elysia for sharing your thoughts. Just out of curiosity, what counts as a 'modern' language. Are you talking about Ruby or python or.... ? I'm definitely going to get on with C++ now, so it was as I said, just out of curiosity.

Maxorator - thanks for the clear advice.

Well thank you everyone for sharing your thoughts - very helpful in shaping up a plan. I decided in the end to get out my C++ notes from the tutorials here and am currently trying to go quickly through Bruce Eckell's book.
officedog is offline   Reply With Quote
Old 11-28-2008, 12:01 PM   #11
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
Quote:
Originally Posted by officedog View Post
Thanks Elysia for sharing your thoughts. Just out of curiosity, what counts as a 'modern' language. Are you talking about Ruby or python or.... ? I'm definitely going to get on with C++ now, so it was as I said, just out of curiosity.
I'm not sure, but I would count C++, Java and C# as modern languages, at least. Perhaps even Visual Basic.
Not very knowledgeable about languages.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-28-2008, 12:06 PM   #12
C++ Witch
 
laserlight's Avatar
 
Join Date: Oct 2003
Location: Singapore
Posts: 11,372
Quote:
Originally Posted by Elysia
I'm not sure, but I would count C++, Java and C# as modern languages, at least.
On what basis do you consider them "modern"? It certainly cannot be period of time, since you exclude Objective C but include C++.
__________________
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar

Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
laserlight is offline   Reply With Quote
Old 11-28-2008, 12:08 PM   #13
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
Features and ease to develop modern applications.
And as far as I'm concerned, Obj-C is just a rip-off of C that we could do well without. If you need object oriented and C, I would choose C++. But I'm known to be biased.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-28-2008, 12:21 PM   #14
MENTAL DETECTOR
 
whiteflags's Avatar
 
Join Date: Apr 2006
Location: United States
Posts: 3,295
Quote:
Features and ease to develop modern applications.
Then what is a modern application?
__________________
<Niggawatts> Writing is both mechanical and organic
<Niggawatts> It's like a cyborg dragon.
<Niggawatts> Writing is like a cyborg dragon.
whiteflags is offline   Reply With Quote
Old 11-28-2008, 12:23 PM   #15
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,819
Quote:
> The preferred language for games is C++
Careful! The big troll is pushing C# something wicked.
That does not mean it is the best choice for them. I think they are pushing this for small games and apps that can run both on PC and XBox. I seriously doubt any real game dev companies are considering using it. I'm sure that the big retail games are running C++ even on the XBox.
C# is a great language and very useful albeit I feel Microsoft is pushing it for something it really was not designed for just to keep it relevant. I believe it's relevance comes in the fact that it is so simple to create GUI apps and the idea of no headers which I must say I do enjoy.

I could be wrong but with games even pushing the speed envelope using C++ I seriously doubt any company is going to risk using a completely different language. Mainly because I don't see what it brings to the table that C++ does not and most of the game engines at companies are already in C/C++ so migrating to C# would be a pain.

I've also noticed that most of Microsoft's so-called C++ code look strangely like C programs. If you look at the DXUT you will see one file has over 6000 lines in it. Does not look like C++ to me. So we have a company that does not appear to push good object oriented code pushing some new object oriented language? Makes me feel all warm and fuzzy inside. Microsoft is masterful at C but not with C++. Most of their programmers are probably hard-core C programmers and you can tell it when you look at their supposed C++ code.
__________________
If you aim at everything you will hit something but you won't know what it is.

Last edited by Bubba; 11-28-2008 at 12:28 PM.
Bubba is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OOP flu Hussain Hani General Discussions 15 06-27-2009 02:02 AM
Data Mapping and Moving Relationships Mario F. Tech Board 7 12-14-2006 10:32 AM
Logical errors with seach function Taka C Programming 4 09-18-2006 05:20 AM
recommendation for a good OOP book Mario F. C++ Programming 2 06-15-2006 04:28 PM
Folding@Home Cboard team? jverkoey General Discussions 398 10-11-2005 08:44 AM


All times are GMT -6. The time now is 12:05 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22