you can use the terminal to compile your c++ code that way you can write it normally if you don't want to have to be confined to osx. just go to the terminal and type "man cc" and it will give you the instructions on how to use it. the cc command is actually just what project builder uses. and i actually suggest to look carefuly at the objective c code. the basics in your c++ class can be better applied in an objective format. email me at myahmac@mac.com and i can give you more info. i am a senior in highschool currently taking AP Computer Science so i know where you are coming from.

[quote]Originally posted by myahmac:
<strong>you can use the terminal to compile your c++ code that way you can write it normally if you don't want to have to be confined to osx. just go to the terminal and type "man cc" and it will give you the instructions on how to use it. the cc command is actually just what project builder uses. and i actually suggest to look carefuly at the objective c code. the basics in your c++ class can be better applied in an objective format. email me at myahmac@mac.com and i can give you more info. i am a senior in highschool currently taking AP Computer Science so i know where you are coming from.</strong><hr></blockquote>

how is that course?

my school just killed it due to lack of interest right before I was about to take it
<img src="graemlins/hmmm.gif" border="0" alt="[Hmmm]" />

Despite that, the tech guy at my school gave me the C++ textbook to try and due it on my own over the summer and next year.

I don't want to start a language debate BUT C++ sucks hard. Using it as programming language when you have to is murder, using it to learn programming is madness - the bad habits you learn will haunt you for the rest of your career. I am currently learning / perfecting / dabbling with C, Objective-C, Java, Ruby, Eiffel and Haskell amongst others. Any of these languages will teach you the fundamentals of programming far better than C++.

If you want to become a darwin/unix guru then learn a scripting language (Ruby is my choice) as well as Java or Objective-C for application development. In my opinion 'programmers' who only know one language in depth don't deserve the title.

My C++ prof told me to not bother with Objective C if I didn't need to, but it seems that Objective is the more superior form. Just from the few examples that I'm given, I can see how Objective C works and it isn't that hard, but it looks the same as C++ with different syntax to me. How is this wrong?

i think your original question was can you mix obj-c and c++ in your ProjBuilder projects. Yes. i'm almost certain. Obj-C I think gotta have ".m" or something like that as the extension, regular c is ".c", c++ is ".cpp", java is ".java". Add them to a project like adding any file (drag+drop, or project-&gt;add files...). if you put the wrong extension, project builder will get confused and try to treat it as the wrong type of source.

terminal is well and good for compiling, but if your not familiar with unix/linux then your probably not familiar with gnu cc. the man page tells you to chk the developer docs, which then tell you to use the project builder, which you should use anyway.

as far as languages go, c and cpp are the best. learning is tough on 'em though. i haven't yet tried obj-c much yet, looked at it and the syntax seemed phuqd. Java sux bug fricken donkey [explitive deleted]. It's so slow and disgusting (cip: LimeWire). I agree with bawjaws though, in that a programmer shouldn't be limited to any language. once u learned a harder one [and really know it], new ones are easy. the biggest prob i can think of with cpp is that with classes, and inheritance and that sh!t, theres overhead that you can't get around.

some1 asked about ap cs, i'm takin it now (in college) and its basic stuff: the syntax, how to make fns, they tell u what an array is, a little bit about recursion, etc. you can chk out <a href="http://www.cs.rit.edu/~cs1" target="_blank">www.cs.rit.edu/~cs1</a> for info on cs1, from Roch Inst. of Tech. I think AP cs is cs1&cs2, but it might just be cs1. @rit they're using java, but the same basic curriculum applies to all languages, just diff syntax.

why C++ sucks:
the main reason that C++ sucks is (surprisingly) culture. The people who choose to program in it over other languages are making the choice based on raw power and machismo. This is all very well if you are writing an OS kernel (but if you are then why not use C and apply OO concepts) but 99.99% percent of the time the wrong decision is made for the wrong reasons.

It's like opening a pizza delivery business and equipping your delivery boys with scooters or strapping them to booster rockets. The extra power is just going to get you into trouble.

The same people who make a decison like that also overemphasise low-level speed tuning over modularity, understandability and (v. important) high level optimization. Remember the golden rule of optimisation is: don't do it. Ask a C++ programmer about it and they will bore you for hours with pointless second guessing of compiler optimisations and old wives tales that they have never tested in real-life benchmarks - just crappy microbenchmarks. Smalltalkers or Java gurus say 'make it right, then make it fast'.

NB This line of thinking did have some validity 15-20 years ago but Moore's law is making a mockery of it now and only mental inertia lets it hang on.

real example:
You can tell Java books written by C++ refugees. They are the ones that tell you the uppercase method of String is inefficent (because it supports unicode languages with strange casing rules) and you should roll your own for speed that only does ascii. The staggering idiocy of doing something like that flabbergasts me. The 80/20 rule states that 80% of your execution time is spent in 20% of your code. Even thinking about optimising before you find out which 20% is at fault is idiotic. Discussing it in a textbook before you have written a program (or learned the language) is disgusting.

bottom line:
it's horses for courses but unless your specifically aiming at a field where C++ is hanging on then avoid it like the plague. This goes double for people learning programming and developing the skills and habits of mind that will shape your future. C++ is the past, Java (and its evil twin C#) are a stepping stone to the future.

PS the main advantage of Objective-C is that it does not enforce type safety and has a great application library (Cocoa). It is these two elements that make building GUI apps a joy in Objective-C compared with Java or C++ *shudder*.

Freak:
I know that you can add files of multiple types, but how do you make the classes interact with each other? Do I use Obj notation in the .m file when referring to a class in a .cpp?

bawjaws:
I have already noticed the advantage to the dynamic binding that Obj does and I like that flexibility. I guess I'll learn both and decide for myself which is better for my purposes. The fact that Apple uses Obj is a pretty good cue

I'm vaguely familiar with the command line tools. I used cc to compile my C programs last term via the command line and that worked well, but then I figured out how to make terminal based apps using Project Builder and I use that now.

pardon me, but it seems ridiculous to assume that if a prog'r uses cpp that s/he feels compelled to optimize everything. I'm in the middle of writing a game engine (in cpp), which is a case where optimization is excessively important (gotta get more fps), but when I write other things, if time is not a matter, i don't look to optimize. i realize that where speed isn't important its okay to be slow (and your practically guarantted to b slow in java). it seems kind of silly to me to read that you shouldn't optimize. prog'in time of course, shouldn't b wasted on speeding up everything (net effect is usually nil), but profiling first, and seekign the time hoggers.

i dont know much about obj-c, or c#, but i dont like the idea of a proprietary language. i dont know if there are unix/linux/windoze compilers for obj-c, but i'm pretty sure that c# is ms' disgusting windows-only language.

Objective C++ is a hack to deal with legacy C++ code being ported to Cocoa.For OSX Objective C is a much better choice.C++ is a very messy,poorly designed language.I've heard Brian Greenstone,the founder of Pangea Software describe it as "the language of the devil".
A couple of elegant and powerful languages worth learning are PHP,and steve,my current
favorite among the "little languages".

Objective C is a tad slower than C++, it can be sped up somewhat by using static typing and binding,but doing that would miss the point of the language.Maybe I was a little harsh on C++,but there are a lot of weird inheritance problems that crop up,mysterious bugs that have no obvious cause.For Cocoa,Objective C is by far the better choice.One thing I don't like about Objective C though is the lack of dot syntax,it isn't possible to access a variable without writing accessor functions,which is a pain in the ass.Of course,Objective C is flexible enough that it is possible to write a single accessor function for every variable.

It seems you all want to/have to programm in C++ and hey, it's your call, but even so, Java is obviously the language to learn first. (In fact, I was under the impression that introductory CS courses were defecting in droves. Maybe the US is behind the times.)

C is a bad choice as it is not OO. Many people think that there is a progression C -&gt; C++ or Java cos that's how they did it but they are fundamentally different paradigms and OO is easier to learn.

reasons Java is better than C++ as a learning language:
It is more OO (though not 100%)
No explicit memory managment == no impossible bugs
No crazy pointer arithmetic, *p++ = *q++ WTF?
Junit is a great learning/programming tool
relatively easy GUIs
Popularity, (C++ has an installed base but Java has all the cool projects/buzz/mindshare and is more likely to get you chicks)
Exceptions
Interface based multiple inheritence
Standard libraries by and large are examples of good practice and OO patterns.
and many others...

At the end of the day a well written Java program will look very similar to a well written C++ program. But a badly written C++ program will look a hell of a lot worse.

For Code Master, C++ bad habits to avoid:
writing procedural code cunningly disguised as OO
lines of code shouldn't have side effects so don't use the variable++ or ++variable operator except on a line by itself.
wanting to overload an operator is a sign that you don't completely understand OO
remember, code that takes up less space on the screen doesn't necessarily run faster.
Objects, polymorphism and dynamic dispatching slow down your programs. The guys who invented them knew this and still felt is was a worthwile trade-off over 20 years ago. They were far better programmers than any of us will ever be (no offense) and had far less processing power to play with. Meditate on that the next time you attempt to 'avoid the overhead' of a dynamic method call.
avoid multiple implementation inheritence, it'll bite you in the ass when your not looking
just because it compiles doesn't mean it does what you think it does. Static type checking isn't the end of the story.

Again, (and I don't know how well this will go over with CS types) culture is important in programming. Unit testing, refactoring, code clarity, agile methodologies (like extreme programming) and advanced use of object orientation are not enforced by Java any more than they are in C++ but it is a fact that they are more prevelant in the culture and that makes it easier to learn good programming habits from the books, people, courses and source code examples that are available.

one last thing, while i'm up on my high horse. Computer Science != Software Development. If you ever find yourself reimplementing a search algorithm then give yourself a slap and use one that is available off the shelf. As someone's sig recently said when everyone reinvents the wheel you end up with a lot of square wheels.

Thanks bawjaws!
I know the CS department at my university has switched to starting with Java, but I'm in engineering we still do C and C++, prolly because it's headed toward very hardware level applications, though I think they just use C for that anyways.

[quote]Originally posted by Code Master:
<strong>Thanks bawjaws!
I know the CS department at my university has switched to starting with Java, but I'm in engineering we still do C and C++, prolly because it's headed toward very hardware level applications, though I think they just use C for that anyways.</strong><hr></blockquote>

yea, that's what I have seen looking through what courses are in the various engineering majors.

while I'm at it.. wat's the basic difference between Computer Science, Computers Systems Engineering and Electrical Engineering with a Computer Hardware Focus?

I mostly agree with bawjaws. Object-oriented programming is good. C++ is overly complicated and bad. Java is good. However, I would not suggest Java or any object-oriented language as your very first language. Ya gotta learn the basics first. Rightfully, most CS departments feel the same way. First, they teach you C, Pascal, or Fortran. Then, they move on to Java or C++. I suggest getting into object-oriented programming very early, but not as your very first language.

Also, although Java is a great language, it is currently too slow and too much of a memory hog for many situations. In my experience, even with native compilation, Java applications are much slower and use much more memory than their C/C++ counterparts. Soooo... C/C++ is still (unfortunately) the most popular programming language. And serious programmers need to know it.

[ 02-23-2002: Message edited by: Brian J. ]</p>

"There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no...

[quote]Originally posted by applenut:
<strong>
while I'm at it.. wat's the basic difference between Computer Science, Computers Systems Engineering and Electrical Engineering with a Computer Hardware Focus?</strong><hr></blockquote>
CS is usually a liberal arts degree while the other two are engineering degrees. In CS, you learn mostly about software. You only learn hardware design at the logical level, and don't learn anything about physics or electricity. In EE, you learn mostly about hardware, physics, electrons, etc... And you learn very little about software. Computer Engineering is in between the two. I did CS, but took as many hardware courses as I could. If you want to be a systems level programmer, such as an OS X engineer or a device driver programmer, you need a decent understanding of hardware.

No offense to hardware engineers, but IMHO CE or CS is definitely the way to go. It takes a lot of capital to develop hardware, so hardware engineers often get stuck being a "cog" in a big company.

[ 02-23-2002: Message edited by: Brian J. ]</p>

"There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no...

[quote]Originally posted by applenut:
<strong>wow guys. that was great and really helped a lot. Really appreciate it.

So, considering I have no programming experience but definitely want to get into it deeply what would you guys reccomend as a starting language?</strong><hr></blockquote>

I highly recomend <a href="http://www.realsoftware.com/" target="_blank">REALbasic</a>. Many people will argue against it, but it makes developing apps for Mac OS X, Mac OS 9 (Cocoa can't do this, and with C it's somewhat difficult), and even M$ Windows simple (i.e., only minor changes to code in a very large project). It is also a very good teacher of Object Oriented programming.

For a starting language I would recommend plain QBasic. Once you get the let statement down, everything begins to make sense. It is an easy way to learn loop and other things. This is what I took last year as a sophomore in high school. Now I am taking AP Comp. Sci. in C++ of course, and it is very easy since all of the concepts are basically the same until you get to OOP. I think it would be very hard to start out completely on your own though. I would not have enough the patience for that.

C++ is evil, especially as a learning language, for a number of reasons:

Good didactic languages (like Pascal, Modula, Java, Smalltalk, Python) are clean, straightforward and built to encourage one programming paradigm. You don't want to distract students with convoluted grammars riddled with inconsistencies and exceptions, lots of fiddly things to remember, and no gestalt - no overarching, unifying paradigm. Unfortunately, C++ has a convoluted and inconsistent grammar, convoluted semantics, lots of fiddly things, and no gestalt. It's the most designed-by-committee language that I've ever seen, and I've seen a lot of them (including old warhorses like PL/I and COBOL).

C++ is built on C. Unfortunately, while C is elegant on its own terms, it's difficult to master, and its strengths have very, very little to do with OO programming - or for that matter, with contemporary coding standards. Furthermore, its terms aren't terribly relevant anymore - not many people choose languages that were designed to be easy to write compilers for. C++ is so vast and so complicated - in addition to inheriting C's complications - that there are large gaps in feature implementations between compilers, countless bugs, and a shortage of accurate and readable books.

I have two C++ books, one well-known and regarded, that totally flunk out when attempting to describe the behavior inherited from C. They're simply wrong. The OO coverage in both is good, fortunately, but this illustrates where C++'s attempt to please everyone starts backfiring: It brings to mind the old joke that every COBOL (or PL/I or Ada) programmer writes in a different language. And the world is littered with "C++ programmers" who know maybe 50% of the language. Maybe. This is the source of endless quantities of bugs, because one of the most difficult aspects of C (and therefore C++) to master is the way it handles expressions, and (obviously) that's also one of the most basic functions of the language. If you don't know how expressions work in the language you're using, all the OO methodology in the world isn't going to help you. And expressions are precisely where the book I referred to (Practical C++ Programming - admittedly, an older edition) goes wrong!

OK. Now onto the other major disadvantage: C++ is not an object oriented language. It isn't. It has, as part of its endless list of bolted-on features, objects and classes and inheritance, but you have to have a very clear vision of how you want to organize your code, and what features you want to use how (and the caveats from the above paragraph applies: You have to know how they work, and you have to hope the compiler implements them) in order to use the language well. And, of course, if you're just learning to program, you don't have any of those abilities at your disposal.

The argument that students need to learn on C++ because the market uses C++ is absurd: Programmers need to learn how to program, and that is essentially applied mathematics. A good programmer can design software on the back of a napkin, and then implement his design in whatever language he chooses to. That is what students should learn to do, and the best languages for the job are the ones that get out of the way and let the concepts shine through clearly. Java is OK for this (it's a bit too C++-ish). So is Python. Purer, simpler languages like ML, Prolog, Scheme, and Smalltalk are best (remember, it doesn't matter if you never use them professionally) because they allow you to clearly and concisely explore the logical and organizational aspects of programming, which are by far the most crucial.

For actual development, you might want to learn C++ just because it will help put food on your table (for that matter, so will Visual Basic - and don't get me started on Visual Basic). The advantages of "slower" languages like Java, Objective-C, Python and Perl lie in the time it takes to develop programs with them, and the ease with which those programs can be augmented, debugged and supported. If you're planning on working by yourself or with a small team, they're by far the best choices.

The debate about the intrinsic speeds of languages is by and large moot. A talented programmer with an interpreted language can beat a mediocre programmer writing in C or FORTRAN every time, because appropriate choice of algorithms and program design are the most effective optimizations. If you want to pick nits, though, Objective-C has several advantages over C++: Its class hierarchies are much flatter (less searching the inheritance trees), and you can use it almost like a pure OO language to rapidly develop a fully functional - if slow - version of your program and then take advantage of optimization to make it fully functional and fast. At full speed, Objective-C is every bit as fast as plain C is.

If you start with Objective-C you'll need to know less C, but the above recommendations still hold. Your best resources here, besides Apple's documentation, are the comp.lang.objective-c newsgroup, OmniGroup's mailing lists, <a href="http://www.stepwise.com/" target="_blank">Stepwise</a>, and <a href="http://mac.oreilly.com/" target="_blank">O'Reilly's OS X pages</a>. I've heard a lot of good things about Aaron Hillegass' <a href="http://shop.barnesandnoble.com/booksearch/isbnInquiry.asp?userid=0IGMVG9LW0&mscssid=6XPCFX69 8QM19MN9LQ2XU3N2BM4N85W5&isbn=0201726831" target="_blank">Cocoa Programming for Mac OS X</a>, so I'll pass that along. You'd think that Apple's own offering, Learning Cocoa, published by O'Reilly, would be good, but it underwhelmed me.

I have Aaron Hillegass's book,it's excellent,well worth the money-much better than Learning Cocoa.There's also a book called Programming Cocoa written by Scott Anguish and a few others that will be released within the next month or so that should be worth getting,I plan to buy it.

I sort of mentioned it before,but if anyone is interested in programming for the pure fun of programming a language that is worth learning is steve, a very pure OO language used for the Breve artificial life simulation enviroment.steve has a lot of interesting features,such as vectors as a native data type,plus there is a lot of sample code written by Jon Klein,a fantastic programmer,his code is very concise and well-organized.Breve is available here:

[quote]Originally posted by Rick1138:
<strong>No,stay away from RealBasic,it's slow and buggy,and after learning it you'll still have to learn real languages,it's better to start directly by learning high powered languages.</strong><hr></blockquote>

Could you elaborate please? I've been using it for years (since version 1), and I've had no problems with speed or bugginess.

"Because the people who are crazy enough to think they can change the world, are the ones who do." - Think Different

I've seen programs that didn't know where RealBasic apps and when I found out, I as really surprised... Most of my experiences with RealVasic apps have been incredibly slow games and apps and you can tell just from opening them that they are made with RealBasic (that is if they even have custom icons).

But you're quite right, that is prolly more the coders' fault and not RealBasic's.

[quote]Originally posted by graphiteman:
<strong>*Bump*
Well, it looks like no one wants to touch this one with a 10 foot pole.

Seriously, I think that REAlbasic has a very undeserved reputation of being slow and buggy, both of which it is not.</strong><hr></blockquote>
Well, I really don't want to start a flame war, but Basic is an inelegant, ugly language. And I don't like when IDEs automatically generate code. It's nice for trivial tasks, but it gets in the way when doing something challenging. I'd rather interface a clean API myself, rather than have some convoluted "magic" performed automatically. I mean, typing is not the hard part of programming; design is. Also, a tool which automates everything is not going to help a newbie learn the fundamentals of programming.

[ 02-26-2002: Message edited by: Brian J. ]</p>

"There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no...

I didn't have time to reply earlier,but RealBasic is too slow for any app that puts any serious demands on the processor,such as animated graphic apps,3d graphics,any type of scientific computing app,or any app that has to access a database of any size.Generated code just isn't fast enough.

Well, we just did templates in C++ yesterday and I'm very quickly beginning to see how disgusting this language is... Just hack upon hack to make it 'work', there is no obvious way yet to do dynamic binding (that will come apparently, but Objective pretty much started with it) and the arrow notation '-&gt;' is just crude.
Thanks for the heads up guys (and gals?)!

[quote]Originally posted by Brian J.:
<strong>
Well, I really don't want to start a flame war, but Basic is an inelegant, ugly language. And I don't like when IDEs automatically generate code. It's nice for trivial tasks, but it gets in the way when doing something challenging. I'd rather interface a clean API myself, rather than have some convoluted "magic" performed automatically. I mean, typing is not the hard part of programming; design is. Also, a tool which automates everything is not going to help a newbie learn the fundamentals of programming.

[quote]Originally posted by AirSluf:
<strong>And there are several things in any BASIC implementation that are just plain bad concepts for cranking out reliable code. BASIC had it's place 30 years ago, but today it does a newbie more harm than good in unlearning bad habits that are required to use BASIC. The IDE's just pour a syrupy layer over the top of that.</strong><hr></blockquote>

What kinds of bad concepts and habits are you referring to, exactly? ANd could you elaborate on that 'syrupy layer' that you brought up?

REALbasic is completely different from the BASIC of 30 years ago. It's completely object oriented, has proper flow control, etc.

NOTE TO EVERYONE: I'm not trying to start a flame war either, I'm just trying to undo some of the misconceptions about REALbasic that exist.

"Because the people who are crazy enough to think they can change the world, are the ones who do." - Think Different

[quote]Originally posted by Rick1138:
<strong>I didn't have time to reply earlier,but RealBasic is too slow for any app that puts any serious demands on the processor,such as animated graphic apps,3d graphics,any type of scientific computing app,or any app that has to access a database of any size.Generated code just isn't fast enough.</strong><hr></blockquote>

This is true. REALbasic is not quite as fast as a C++ application. But this is changing. REAL Software has been hard at work creating a brand new complier that will address many of these issues. And you can test drive it right now; it's included in REALbasic in the form of RBScript, runtime-compiled version of the REALbasic language.

Please, everyone, before we continue this discussion, if you haven't already done so, download the REALbasic demo and play with it for 5 minutes. I think you will be somewhat surprised at what you see.