Like Tree1Likes

Advice on next steps - shifting to OOP

This is a discussion on Advice on next steps - shifting to OOP within the A Brief History of Cprogramming.com forums, part of the Community Boards category; So far I have had reasonable success with learning C and openGL. My interest is in graphics mainly. I guess ...

  1. #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...

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    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.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    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

  4. #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.

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    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.

    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.

    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > 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?

  7. #7
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    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...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    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.

  9. #9
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    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.
    Last edited by maxorator; 11-28-2008 at 09:27 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  10. #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.

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,452
    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
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  13. #13
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #14
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,638
    Features and ease to develop modern applications.
    Then what is a modern application?

  15. #15
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    > 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.
    Last edited by VirtualAce; 11-28-2008 at 11:28 AM.

Page 1 of 4 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP flu
    By Hussain Hani in forum General Discussions
    Replies: 15
    Last Post: 06-27-2009, 02:02 AM
  2. Data Mapping and Moving Relationships
    By Mario F. in forum Tech Board
    Replies: 7
    Last Post: 12-14-2006, 09:32 AM
  3. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  4. recommendation for a good OOP book
    By Mario F. in forum C++ Programming
    Replies: 2
    Last Post: 06-15-2006, 04:28 PM
  5. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 08:44 AM

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