Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dr0wzy

macrumors newbie
Original poster
May 19, 2010
5
0
Ok so I am having some trouble on starting to learn java. I am going to make a attempt at learning it but now I really need some help on just starting. Please understand that I am a youngin' (younger than 16) and I need some help to just start. Any links to any developing application's would be great. BTW This is my first post and I am running a Macbook pro (the one that is black).
 

qtx43

macrumors 6502a
Aug 4, 2007
659
16
"Thinking in Java" by Bruce Eckel is a nice book, and the previous edition is a free download. If you have specific, to the point, questions then stackoverflow.com is a nice website.
 

notjustjay

macrumors 603
Sep 19, 2003
6,056
167
Canada, eh?
Welcome. And, hey, everyone has to start somewhere. This forum is a good place to start. You'll see posts from everyone from total newbies to experienced programmers. And "experienced" means something different to everyone. For example, I've been programming in C++ and some Java for 10-15 years, but I still don't know a thing about Objective-C or programming for the Mac. One of these days I'll sit down and learn.

I think there are two "parts" to learning about programming. One is the entire concept of programming in the first place, and has nothing to do with the specific language you're learning. Some people "get" it faster than others. And as computers and operating systems continue to advance, there's more to "get" now than there was before. Back in the day, they taught flowcharts, which seems outdated now, but the concepts are still sound. Understand the concept of a computer program performing things step by step. Understand the concepts of functions, variables, conditionals, loops. The second part is, of course, the specifics of the language you're learning.

Use whatever language works best for you to understand those concepts. When I grew up, it was BASIC on an Apple ][. For you, since you're learning Java, that could be it. But don't be afraid to try other languages -- maybe look at Python? -- because the more you learn about the commonalities between the languages, the more you are learning about programming and less about the language.

A couple of things, though. People on this forum don't like it when people are obviously being lazy, or posting homework assignments hoping that others will write the code for them. I'm certainly not accusing you of this, but if you do have questions, try your best to find the answers on your own. Google is a great help. Read the docs (Java is FULL of docs). Try some examples. I find this is the best way to learn -- by doing, trying, failing, learning, trying again. If you're still having difficulty, post a message and indicate what you've tried, and we'll do our best to help you.

I'm paid pretty decent money to program C++ for a living, and you know what? I Google things dozens of times a day when I forget what a function is called or need to see an example of how a certain chunk of code is supposed to be written.

I hope that's helpful!
 

ranguvar

macrumors 6502
Sep 18, 2009
318
2
I'd recommend taking a course at school. Learning from books is cool, but at the beginning, you might have quite a lot of questions about thinking object-oriented, so an actual person to talk to would be better.

Also, remember that programming isn't about creating shiny applications in the first week. Get ready for looking hours at code and not seeing any graphical results of your work :)
 

Avicenna

macrumors member
Jul 16, 2009
89
0
yea..as someone else mentioned above, get ready for sleepless nights thinking about where that little bug in your code is coming from...
 

chrono1081

macrumors G3
Jan 26, 2008
8,456
4,165
Isla Nublar
yea..as someone else mentioned above, get ready for sleepless nights thinking about where that little bug in your code is coming from...

LOL that is so true! But, sleep also solves programming bugs too sometimes. I've dreamt about programming many many times lol.

To the OP, although I can't comment on Java, I will say this holds true for any language: You will get stuck and frustrated MANY times. It's part of learning programming so I hope you are ready for it ;)

It does get easier with time though and once you get more experience you will be able to switch from language to language with very little problem.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
I'm amazed no-ones noticed this yet: there are no (and have never been any) black MacBook Pros (colorware excluded). You have a MacBook (no Pro).
 

dr0wzy

macrumors newbie
Original poster
May 19, 2010
5
0
Ok Yeah I get all the points you guys are saying. And about python, I just feel like I would rather go for learning a language that is more "object oriented". I maybe didn't convey what I was meaning. I am wondering how to just start programming on a mac, meaning I need some help finding a compiler worth my
space.
 

mdatwood

macrumors 6502a
Mar 14, 2010
914
889
East Coast, USA
yea..as someone else mentioned above, get ready for sleepless nights thinking about where that little bug in your code is coming from...

This is why I keep my iPhone (for Evernote) and a pencil and paper next to my bed. I was laying awake for hours last night 'working' on this UI I need to get designed and coded.

To the OP,

Python is object oriented also. I wrote a blog post about which language to learn first based on how you think you learn. Check it out.

*EDIT*

Also, OSX should already have python, ruby, and java interpreters/compilers installed by default.
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory

Detrius

macrumors 68000
Sep 10, 2008
1,623
19
Apex, NC
I'm amazed no-ones noticed this yet: there are no (and have never been any) black MacBook Pros (colorware excluded). You have a MacBook (no Pro).

I just assumed this was in reference to the black screen and keys on the unibody MacBook Pros, but yes, you're probably right.
 

firewood

macrumors G3
Jul 29, 2003
8,108
1,345
Silicon Valley
start easier

Some people can jump right in, and learn a professional programming language right from the beginning.

But most of these professional programming environments were not designed for teaching/educational purposes. So if you're having problems getting started the hard way, I suggest first learning an easier educational, even toy, computer language. Learning a second/3rd/etc. programming language afterwards is usually a bit easier after you've already figured out how to write and debug programs.

Squeak, Scratch, Alice, Logo, even Basic. Or maybe an easier "real" language: Python, Javascript in your browser, Scheme, Forth if you're an RPN calculator expert, etc.
 

dr0wzy

macrumors newbie
Original poster
May 19, 2010
5
0
Thanks for the suggestions about ruby. It looks like something that would fit what I need. Thanks guys for your help you get a cookie :):)
 

ThaGrapist

macrumors newbie
Feb 13, 2010
17
0
NC
If you go the Java route, BlueJ is a really nice IDE for beginners. It will help with the OO concepts, since it can visualize class relationships for you on the fly. I still occasionally use it for some of the object manipulation capabilities it has, which are really useful when debugging.
 

macsmurf

macrumors 65816
Aug 3, 2007
1,200
948
I think you're making a good decision by choosing a "pure" language. Languages can be put into certain groups known as paradigms and some languages are considered multiparadigm. Python, for example, has aspects of both procedural and object-oriented programming.

Java is very popular as a learning language. There are several reasons for this. First of all, it is a (somewhat) pure object-oriented language. There is an exception, known as primitive types, that were originally put in for performance reasons. I don't think that this will cause any confusion, though. You might not even notice the difference (but any good programming text will point them out for you). Another reason is that Java is quite verbose. You have to write a lot of stuff that could have been made shorter by the designers. On the other hand, you have to really understand what is going on before your programs work.

Because Java is such a popular choice for a first language, there are lots of books and resources on the web for this purpose. The fact that it is used professionally shouldn't discourage you.

Ruby is, some ways, more purely object-oriented than Java (no primitive types). On the other hand, it has some components from the functional programming paradigm that may be difficult to grasp for a beginner. It also has a lot of syntactic sugar which is basically shortcuts that allow you to specify something in a short form. This is great for programmers who already know their stuff but on the other hand it may obscure the actual meaning of the code for beginners. Less verbosity is nice but only if you know what is going on.

Some people say that Ruby is a great first language. I agree that it is a great language but I doubt the claim about it being a good language for beginners. It might be true, though. I simply don't know.

If you go the Ruby way, you should get the book "Programming Ruby" by Dave Thomas. It is also known as the pickaxe book and is well written. It includes a lengthy introduction/tutorial that will teach you many of the concepts you need to learn.
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
Python, for example, has aspects of both procedural and object-oriented programming.

Don't forget functional influences either :).

Java is very popular as a learning language. There are several reasons for this. First of all, it is a (somewhat) pure object-oriented language. There is an exception, known as primitive types, that were originally put in for performance reasons. I don't think that this will cause any confusion, though. You might not even notice the difference (but any good programming text will point them out for you). Another reason is that Java is quite verbose. You have to write a lot of stuff that could have been made shorter by the designers. On the other hand, you have to really understand what is going on before your programs work.

Because Java is such a popular choice for a first language, there are lots of books and resources on the web for this purpose. The fact that it is used professionally shouldn't discourage you.

Ruby is, some ways, more purely object-oriented than Java (no primitive types). On the other hand, it has some components from the functional programming paradigm that may be difficult to grasp for a beginner. It also has a lot of syntactic sugar which is basically shortcuts that allow you to specify something in a short form. This is great for programmers who already know their stuff but on the other hand it may obscure the actual meaning of the code for beginners. Less verbosity is nice but only if you know what is going on.

Some people say that Ruby is a great first language. I agree that it is a great language but I doubt the claim about it being a good language for beginners. It might be true, though. I simply don't know.

If you go the Ruby way, you should get the book "Programming Ruby" by Dave Thomas. It is also known as the pickaxe book and is well written. It includes a lengthy introduction/tutorial that will teach you many of the concepts you need to learn.

Good advice. Java is a nice easy way to drop into programming, but then I still think that C is an OK language to start off with too, considering that was the first language I ever learnt.
 

macsmurf

macrumors 65816
Aug 3, 2007
1,200
948
Don't forget functional influences either :).

You're right. :eek:

Good advice. Java is a nice easy way to drop into programming, but then I still think that C is an OK language to start off with too, considering that was the first language I ever learnt.

C will teach you the procedural paradigm and I'm guessing it will be a difficult journey but a rewarding one. It's a language close to the native CPU language and will teach you about the sytem architecture as well.

However, subtle bugs much? :) C was my third language (Basic & Pascal before) and I remember one bug in particular. I'd defined an array and defined the counter directly after the array definition. I started out by blanking out the array with zeros. Boom, infinite loop. WTF? It turned out that I went out of bounds on the array and overwrote the counter with 0 as well. Pretty subtle for a beginner. One the other hand I learned something. Let's pretend I never made a one-off error ever again ;)
 

Bill McEnaney

macrumors 6502
Apr 29, 2010
295
0
I don't understand. Was the counter a separate variable, or did you build it into the array? I'm not a C expert, but in Pascal, I've sometimes written something like this:

Code:
[B]const[/B] Capacity = 120;

       [B]type[/B]
          Element_Type = integer;
          Index_Type = 0 .. Capacity;

          List_Type =
             [B]record[/B]
                Element: array[Index_Type] of Element_Type;
                Last: Index_Type
             [B]end[/B];

     [B] function[/B] Empty(List: List_Type): [B]boolean[/B];
        [B] begin[/B]
            Empty := List.Last = 0
        [B] end[/B];

    [B]  function[/B] Full(List: List_Type): boolean;
         [B]begin[/B]
            Full := List.Last = Capacity
     [B]    end[/B];

      [B]procedure[/B] Insert(Another_Element: Element_Type; var List: List_Type);
         [B]begin[/B]
           [B]if[/B] Full(List) [B]then[/B]
              writeln('The list is full.')
          [B]  else[/B]
            [B]   with[/B] List [B]do[/B]
                  [B]begin[/B]
                     Last := succ(Last);
                     Element[Last] := Another_Element
                 [B] end[/B]
         [B]end[/B];

Why did I use the successor, succ, function to change the value of Last? I did that to make the code more general because Pascal allows subscripts that aren't integers.
However, subtle bugs much? :) C was my third language (Basic & Pascal before) and I remember one bug in particular. I'd defined an array and defined the counter directly after the array definition. I started out by blanking out the array with zeros. Boom, infinite loop. WTF? It turned out that I went out of bounds on the array and overwrote the counter with 0 as well. Pretty subtle for a beginner. One the other hand I learned something. Let's pretend I never made a one-off error ever again ;)
 

qtx43

macrumors 6502a
Aug 4, 2007
659
16
I don't understand. Was the counter a separate variable, or did you build it into the array? ...
In C an array is just a block of memory, no bounds checking, no memory protection (at the language level). He's probably talking about something like:
Code:
#define SIZE 10
int array[SIZE];
int i;
for (i=0; i<=SIZE; ++i)
  array[i] = 0;
You can see that the "int i" is probably stored in memory immediately after the array.
 

Winni

macrumors 68040
Oct 15, 2008
3,207
1,196
Germany.
Ok so I am having some trouble on starting to learn java. I am going to make a attempt at learning it but now I really need some help on just starting. Please understand that I am a youngin' (younger than 16) and I need some help to just start. Any links to any developing application's would be great. BTW This is my first post and I am running a Macbook pro (the one that is black).


This is the best book to learn Java:

"Head First Java" by Kathy Sierra and Bert Bates, O'Reilly, ISBN 0-596-00920-8.

You do NOT need an IDE and you should NOT overload yourself by trying to learn Java AND a compley IDE like Netbeans or eclipse or - horror! - Xcode. Just as Kathy Sierra recommends, a simple text editor (e.g. jEdit, TextWrangler or BBEdit) and the Mac's Terminal window will be sufficient.

Java is already complex enough, so keep everything as simple as possible.

Just buy ONE book and stick to the Java command line tools and your text editor while you work your way through that book. And it might be a good idea to stay away from Internet forums while you're studying that book -- it will only confuse you more instead of helping you get anywhere.
 

FlyingHonda

macrumors newbie
Mar 9, 2010
8
0
May I suggest the fantastic upcoming indie game, Minecraft?
A couple of years ago, this sparked my interest in Java... I mean, come on! It has stereoscopic 3D! The developer, Markus Persson, AKA Notch, sometimes posts snippets of his Java based genius on his development blog. Other than that, good luck!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.