views:

558

answers:

15

I want to learn some basics of software design (with the idea to expand thereupon later), particularly for mac and mobile devices. I am new to programming and have only basic HTML experience, so pretty much a complete novice. Are there any suggestions as to where I should start? I have just bought Herb Schildt's beginner's guide to C++, but I am now questioning whether or not it is the best place to start. Thanks in advance and apologies if this has been covered before, I couldn't find this topic on the site.

+4  A: 

If you aim to develop primarily for the Mac and iPhone I would stick with Objective C - this is the defacto standard for those platforms.

Otherwise I'd recommend Java, this is a practical language to learn, popular in many domains, portable and will let you write mobile apps for Android pretty easily.

I like C++ for many reasons but it's hard for beginners and mainly useful if you want to do systems programming or write code that is "close to the metal".

mikera
@mikera: Java is good for blackberry also
Jordan
+1: C++ is pretty much the last language I'd choose to start programming with, and I've done *many* years of it.
Groky
Java? Yuck! (in 15 characters)
Billy ONeal
why not **Python**?
Gollum
@Billy I'm giving you the benefit of the doubt that you meant to add a smiley there :-)
mikera
@mikera: Err.. no, I don't mean a smiley there. I mean Yuck! I did not downvote the answer, but I do not agree with it. If the question was CW, as it should be, I would have downvoted it.
Billy ONeal
OK, thanks, looks like objective-C is probably the best for Mac/iPhone.
Rob
How exactly does this make things easier? objective-C is great because it's taught in many universities, but given his experience and his wish to self-educate. Is this really the right option? Definitely a good option after some previous experience :)
Justian Meyer
@Billy in which case that is quite sad - the aim here is to give practical advice based on an honest question, not start a language flamewar/vote based on your prejudices.
mikera
@Billy p.s. please feel free to post a constructive alternative answer - I'm always keen to hear different perspectives.
mikera
+2  A: 

If you want to do mac/mobile (presumably meaning iPhone), you're better off just jumping straight into Objective C.

Tim Coker
OK, thanks. I think I'll start with Python and then move on to Objective-C. I wasn't expecting to be making any groundbreaking apps anytime soon, so I suppose no real rush to do solely mac/mobile. Thanks for your help.
Rob
+1  A: 

C# is on a par with Java in terms of ease of use and with it you'll be able to write applications for Windows Phone 7 devices.

ChrisF
I hate to admit it but C# is probably a bit better than java--however you just won't find many C# phones, it would be far fewer phones than if you learned Objective-C, which would be far fewer than Java.
Bill K
@Bill - true, but I thought they should be mentioned.
ChrisF
Are there any Windows Phone 7 devices currently? Right now, I'd suggest not making that your priority, as Microsoft hasn't demonstrated the ability to make a widely used mobile phone. If the OP wants to write mobile apps, either Objective-C or Java would be much better choices at this time.
David Thornley
OK, thanks for your help, I will take that into consideration.
Rob
+1  A: 

You have to make a choice - do you want to learn scripting languages or Object Oriented languages. My suggestion is to start with either Java or C#, just because there is so much to learn and find on the internet - if you run into trouble.

Both are Object Oriented languages, and have extencive class libraries you can start learning. If you want to learn mobile, I think Android is a better choice, since its open accessible and doesn't require you to pay 99 USD to put your application on a device. Android makes use of Java and XML (which is very similar to HTML).

Good luck!

BennySkogberg
OK, thanks. Yes, I heard about the subscription to publish apps on apple devices, which certainly makes that route less tempting. Thanks for your help.
Rob
+2  A: 

I think there are two questions which people fail to answer when beginning to program:

  1. Are you learning to program for a Hobby or is this for a Job
  2. What do you want to build?

If you are learning as a hobby, start small and just build something. It could be a small messenging program or a program that logs your DVD collection. But the most important part to understand HOW to Build.

If you are trying to get a job as a programmer, the advice is the same. Build something. Get involved with a few open source Sourceforge projects where you'll learn that Actual coding is about 30% of the job, and the other 70% of the job is dealing with changing Requirements, Customer Feedback, and scope changes.

The biggest take away is to put the books away. Figure out what you want, then go about applying the right technologies and framework to build them.

erollison
Amen to that mate.
JonnyLitt
And an important part of building something is to build something interesting, something you actually want.
David Thornley
Good question, it would indeed be as a hobby (at least initially) and I had considered that I need to know what I want to build but, as yet, I have few ideas. Thanks for your help.
Rob
A: 

You also can write iPhone applications in C#. And de Icaza promised to release a tool to write Android apps in C#. You can write Windows Phone 7 apps in C#.

C# is awesome and is simpler to use than Java. Java's lack of, for example, closures is making me mad. After C# switching to Java will be very simple - you'll just have to stop using some cool features.

But I think the best choice is Python. It's simple and beautiful language which is very common for webdev, science or desktop apps.

valya
The current iPhone development agreement specifies that iPhone apps will be written in C, C++, or Objective-C. C# is not on that list, and neither is Python. Moreover, a promise from Miguel de Icaza does not constitute working code suitable for a beginner. For somebody interested in mobile apps, C# is currently a bad place to start.
David Thornley
С# compiles to Object-C as well, so stupid rules from corporation not apply
valya
Yes, I think python sounds like a good starting place, although for Mac/iPhone, it sounds like Objective-C is better. Thanks for your help.
Rob
@valya: That doesn't matter to the developer agreement; you are agreeing, when you get what you need to deploy iPhone etc. apps, that the application is written in C, C++, or Objective-C. Not C#. Please refrain from advocating C# for use where it doesn't work yet or is specifically forbidden.
David Thornley
A: 

C++ is a fantastic place to start. Many scripting programming languages get their structure from C++. In fact most of the time you'll be able to do more advanced tasks in the C++ language better than more higher level languages. If you're willing to take the learning curve and try C++, I'd say go for it.

If you don't want to work that hard on learning languages, you can easily go with other scripting languages that are similar like PHP or Python. Those usually get a basis for what languages will look like and how they'll function, especially C derived ones.

JonnyLitt
That was my initial reason for choosing the c++ book, that most other languages are developed from it. But having read other answers on this question, I think I should probably start out on something simpler, and who knows, maybe I will come back to it one day. Thanks for you help.
Rob
A: 

Depend what you want to do.

If want learn only Java and C# are at same level to learn and exists a lot tutorials. take care that Visual Studio is a payed application (even when exists a free express edition) in other hand Java have full enterprise ready IDEs like Netbeans and Eclipse.

As C++ programmer I suggest you try to learn C++ with a good book as reference (upper you have a good list) because lot of languages are based on it at least in syntax (Java, C#, PHP, Python, etc)

But take care that C++ have a highest learn curve that other ones, but are once that you understand it everything is a piece of cake

BTW: Try to find a logical programming tutorial or something that teach you about HOW TO resolve a problem using pseudo-code instead of concern about a language specific solution.

Gustavo V
Somebody interested in programming for the Mac is likely not to have a system that will run Visual Studio, as well.
David Thornley
David is right, I would be programming on my mac. It was my intention that learning C++ would greatly facilitate the learning of other languages, but I didn't know how far in the deep end I would be throwing myself in with C++. Thanks for your help.
Rob
+10  A: 

C++ is probably one of the worst languages to use to learn how to program. It's a very complex language which often stumps people in various ways even if they have several years of experience with it. It's also a compiled language and it's statically typed (requires you to declare types of variables) - those are not bad things in themselves, but it makes things harder for beginners, I think. And you're also responsible for memory management as it doesn't have any sort of automatic garbage collection.

I'd suggest starting out with dynamically typed language with garbage collection like Ruby, Python or JavaScript. Maybe even Scheme for it's simplicity.

It's kind of like learning to drive: you probably want to start with an automatic shift car so you can concentrate on the practice of driving. Later on you can learn to drive a stick shift (C++).

aneccodeal
+1, Nicely sums up all the reasons why one should not begin with C++.
missingfaktor
OK, nice analogy. I think I'll try Python, thanks for your help.
Rob
+1 "... you probably want to start with an automatic shift car so you can concentrate on the practice of driving ..." good analogy.
Justian Meyer
+1 I'm still a beginner, and I would consider C++ my first language in that it's the first one I've really dedicated to learning, and it's where I have my (very short) programming background. However, I was attracted to programming in the very first place because I heard about Python from http://xkcd.com/353/ , and its simplicity showed me that programming wasn't some impossible thing that only math geniuses can pull off. I learned the basics (IO and conditionals and whatnot) in Python, which helped me a lot when picking up C++ (which I did cause I WANTED to start with the stick shift :P ).
Maulrus
@Justian: And let's not forget to have a manual choke, to learn about fuel-air mixtures. Or, for that matter, a crank instead of a starter motor. A sprained wrist is a cheap price for learning to drive a car using the fundamentals, after all.
David Thornley
@David: Learning to drive a car and learning how it works are two different things. C++ would be the equivalent of all those things, since you need to really understand what's going on under the hood to use it properly.
BlueRaja - Danny Pflughoeft
Oh god don't learn to program with C++, s much as I do like it. it will probably scare you away from programming forever.
Brock Woolf
@BlueRaja: Abstraction ;) Isn't it wonderful? @Brock: My fears exactly.
Justian Meyer
+5  A: 

I would recommend Python for most cases, it's easy enough to learn and has functional features for when you want to branch out. Jython makes it easy to use the Java libraries while still using the same syntax as Python. The only situation I would really use C++ is for CPU intensive tasks like ray-tracing, Kalman Filters/FastSLAM, or work on embedded devices and consoles.

horatius83
Thanks, I think I will try python.
Rob
Is Python suitable for mobile devices?
JBRWilkinson
@JBRWilkinson http://code.google.com/p/android-scripting/
Helper Method
+5  A: 

Just to be contrarian and puritanical: In my ideal world, programmers start with ANSI C (aka C89) and are allowed to touch nothing else until they can at least parse simple files and create very simple data structures (linked lists, hash tables) in sane and reasonable (not necessarily optimal) ways.

After that, they never have to touch C again, and can use C++, C#, Java, Python, INTERCAL, ... I really don't care. I just really wish more programmers had a reasonable grounding in how the internals actually work.

Nicholas Knight
+1 not because I did this, but because I wish I did. It's pretty difficult on your own though. I tried programming in elementary school- how could I be expected to do that?
Justian Meyer
I understand where you are coming from and part of me feels like I should do exactly that. That is the reason I currently feel so lost, I have no idea about how the internals work. However, as others have suggested, I might try an easier language to start with and if I happen to develop any skill therein, I will come back to C. Thanks for your help.
Rob
I guess the C++ tought at many universities is rather "C with access specifiers in structs". It would be much better to start with writting crappy C code instead of horrible, mind-numbing and wrong C++ code.
pmr
@Justian: In a way, all of this really comes from the fact that we still haven't found a good, reliable method for teaching programming, nor even what the prerequisites are (e.g. how much math and with what focus). My puritanical "go learn C" view scares people off, and the "go learn Python" approach leaves people confused about performance characteristics, memory usage, and interfacing with lower-level systems and libraries. We're screwed either way. :(
Nicholas Knight
@Nicholas - Programming is more of an apprenticeship type profession. Even if you can get good grades in a computer science course that does not mean you are a good programmer.
ChaosPandion
@ChaosPandion: Wow. We all know a lot of CS grads make useless developers, but somehow I've never before heard it described as an "apprenticeship profession". It's an extremely apt observation. Now the question is, since it really does seem to be, why isn't it actually _treated_ like one?
Nicholas Knight
@Nicholas - That is a good question. I think our modern society is less inducive to apprenticeships due to the high cost of living. For example, lets say you put together a shop with 2 journeyman programmers. They can pull there weight enough to were they earn a livable salary. An apprentice on the other hand could take years of training to become even moderately productive. This is time where you would have to pay a livable wage.
ChaosPandion
@Nicholas: I absolutely agree, but after reading that he wanted to do it as a hobby, why make him suffer the details from the start? What's worse is that some people will go attempt C, C++, etc. without all the details. I actually saw a class that covered C++ without memory management just because it was for beginning programmers. They don't learn the important concepts and complicate things for themselves in the long run.
Justian Meyer
+2  A: 

If you're new to programming (and basic HTML isn't programming in this sense), I'd recommend starting with something you're going to use. Moreover, I'd recommend starting with something easier than C++.

You stated an interest in Macs and mobile devices, without specifying which mobile devices. If you want to program for Macs and Apple mobile devices (typically beginning with "iP"), you should learn Objective-C to start. If you're interested in programming for Android or (I think) Blackberry, learn Java. Both will be easier to learn than C++, both are reasonable (if not idea) starting languages, and both will allow you to program for some mobile devices.

Alternately, you could learn C. Again, not a great learning language, but a reasonable one, most of what you learn will be applicable to Objective-C, and much will be applicable to Java. You could learn Python, which is an excellent first language, and get more familiar with programming, and then go on to Objective-C and/or Java.

My advice is to learn one thing at a time, but never be afraid to learn something new.

David Thornley
OK, looks like Objective-C is the place to start for Apple devices. Sorry I should have specified, it would be "iP" devices and possibly for Nokia's Symbian platform (as that is what I have). But I think I will take your advice and start with Python. Thanks very much.
Rob
A: 

C++ is a very mixed language, so you won't be able to learn the concepts in isolation. You'll likely end up spending more time trying to grasp C++ than you will just learning two other more specialized languages first, and then learning C++.

It's best to learn each paradigm from a language that's designed from the ground up for it.

I suggested this order a few years ago to my friend, and it seems to have worked for him:

1: An OOP language

At the very least, you'll want to learn how to design applications, so start with a language like Python, Java, C#. Like it or not, OOP is a bit of a necessity if you want to work on semi-big projects.

2: C

C will give you an understanding of how your CPU works and how memory management works.

3: Objective-C/C++ for Mac dev

Objective-C and C++ are obth C with OOP extensions, so neither should take you more than a couple weeks to learn.

Your code will be a lot tighter if you learn OOP and C separately first, and you'll spend less time trying to figure out the best way to do things.

4: A functional language

After all that, if you want to be really top-notch, learn a functional language. You'll feel weird, at first in a bad way, and then in a really good way.

OCaml and F# are both practical for writing real-world applications, but again, they mix OOP with functional, and you're better off learning functional programming in isolation, so I would recommend Haskell, which is a pure functional language.

Rei Miyasaka
Yes, it seems Python is the place to start, thanks for your sequence, looks like a good path.
Rob
A: 

I agree with others here that C++ is not a good language to jump into if you're just starting out for many of the reasons they cite. If you are truly a beginner at programming and you have a mind to think visually / graphically, you might consider a couple of languages that came out of MIT specifically designed to teach programming concepts.

Scratch provides a framework for learning the basic concepts of programming.

Star Logo TNG is similar to Scratch and is useful for creating interesting simulations by focusing on agent behavior rather than all of the stuff that goes on under the hood.

Google has taken this same general approach with their new Google App Inventor for Android. It uses a graphical language similar to Scratch and Star Logo TNG to build Android apps.

All of these will give you a good feel for the various types of control structures and by looking at some of the examples / tutorials they will be a lightweight introduction into both structured programming as well as some (but by no means all) object oriented programming concepts. Once you have an intuitive understanding of those concepts, I think you'll be better suited to start picking up languages that are a bit more mainstream and that implement more advanced object oriented features.

For what it's worth.

andand
Interesting, thanks for that I will look into it.
Rob
A: 

C++ is perfectly good as a learning language - but this can depend on your teaching material. I personally don't recommend the Schildt books - in my opinion, they miss the big features of C++ (polymorphism, templates, STL, etc) as they just present them as new ways of doing old C things (e.g. cout is the new printf)

In C++, you can stay high-level if you wish to avoid getting to intimate with things like pointers and memory allocation, but there are other languages that may give you a better route into the programming world...

If you are already familiar with HTML and are looking to write for mobile devices, if I were you, I would seriously consider learning JavaScript, for the following reasons:

  1. It's cross-platform - runs in almost any browser on multiple OS's, desktop and mobile.
  2. The language is mature and has many modern and even cutting-edge features applicable to other languages such as garbage collection, closures, OOP, anonymous functions, delegates, collections, duck typing, etc.
  3. Partnered with HTML and CSS, you can target iPhone, Android and Windows mobile devices plus all desktops.
  4. There are many IDEs and debuggers available (Eclipse, XCode, VStudio, etc)
  5. JavaScript syntax is very similar to C/C++, Java, C#, and to some extent Objective-C and others. So your investment here will pay back if you learn any of those.
  6. There's a ton of sample code out there including some awesome frameworks like jQuery, Prototype, etc.
  7. You can get instant results - just refresh your browser
  8. Application distribution can be a breeze - simply upload the new code to your website.
  9. There are also out-of-browser scenarios:

    • On Windows, you can do JavaScript coding with real benefits as many things in Windows have COM interfaces which are scriptable via J(ava)Script. See examples on MSDN library.
    • Google Gadgets/Yahoo! Widgets/Mac Dashboard Widgets/Windows.. Sprockets?
    • In Firefox, I think the UI is built using JavaScript and an HTML-like language named XUL.

Once you're proficient in JavaScript, you can investigate the features of the other languages including compilation, extensive frameworks support and higher performance.

JBRWilkinson
OK, thanks for your help I will look into JavaScript.
Rob
Learning JavaScript as a first programming language fits only to "Web-programmers"(and for this Javascript is unreplacable) but if you want to do something serious please learn another language first.
Quonux