Learning JAVA

Bo
Boys of Summer
Posts: 75
Joined: Wed Oct 10, 2007 3:14 am
Location: Boston

Wed Jul 30, 2008 3:21 pm Post

Hi All:

In the last few months, I have been utilizing Apples $99.00 purchase for 1 on 1 private lessons in order to learn how to program in JAVA. (This is a bit unusual as it is really intended to teach only the programs they have on their Macs but I found a guy who is brilliant and willing to teach me.)

I am having great fun but for a guy that has never programmed before, it is not exactly a cakewalk but I am making progress.

The purpose of this request is to see if anyone has a “crib sheet” (covering common commands for example)that might serve as a guide as I struggle along in my programming. I saw one for Objective C but I have not seen one for JAVA. Can anyone help?

By the way, I am reading a great book called “Dreaming in Code.” Amazing story.

Best to all,

H
"She watched him turn and walk out of the park, and she wondered about him all of the rest of the day, this strange man with the intense look, who stood in the middle of the park, in love with it."

User avatar
juh
Posts: 156
Joined: Fri Dec 01, 2006 11:43 am
Location: Germany
Contact:

Wed Jul 30, 2008 5:07 pm Post

There is a book called Java in a nutshell, which might serve you.

But generally Java is not the best choice as first programming language. Its bloated. Python is much more concise and elegant. You need seven times more code you need in Python to do the same in Java.

See the brilliant rant of Sean Kelly
http://seankelly.tv/blog/blogentry.2006 ... 3319928440

User avatar
KB
Site Admin
Posts: 20901
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Wed Jul 30, 2008 6:04 pm Post

But on the other hand, SproutCore is based on Java, so Java may be pretty handy if you want to develop some cool web-based apps...

ma
matt
Posts: 1180
Joined: Mon Jul 30, 2007 9:35 am

Wed Jul 30, 2008 11:46 pm Post

juh wrote:There is a book called Java in a nutshell, which might serve you.

But generally Java is not the best choice as first programming language. Its bloated. Python is much more concise and elegant. You need seven times more code you need in Python to do the same in Java.

See the brilliant rant of Sean Kelly
http://seankelly.tv/blog/blogentry.2006 ... 3319928440


I have to say, I completely disagree with you regarding using Java as a teaching language.

I taught Computer Science at University for many years and we always used Java as an introductory programming language. There are things it could do better and it requires a lot more work on the GUI side than other development environments (XCode+Interface Builder, Visual Studio, Borland...)

But for a learner, it is a great help to get useful error messages rather than "Access violation" or "Seg fault", and it is a good tool to teach almost all aspects of programming, from the basics through to recursion, threads and synchronization, networking and sockets, design patterns like MVC etc.

As long as it is being taught properly, students can learn good programming practices with Java (arguably better than they would learn with C/C++) and Java's libraries etc. provide an easy way to cover the important aspects of all of those other things I mentioned above. The only thing you won't cover is pointers and memory allocation, but that doesn't take too long to pickup once you switch to a language that uses them.

To be honest, people who rant against particular programming languages, or carry on about one being so much better than the other are pretty boring and usually wrong. Carrying on about Java being an "addiction" is just pathetic, and says more about the programmer than it does about the language.

So its not great for every application, and perhaps not great for professional release software. Neither is python for a lot of applications. And the first reply down says, "no, no, python is evil too, Ruby is the only thing that matters". What crap.

Pick a language, any language. Learn it well. Learn all the concepts you need to learn. Then as required, apply it to whatever language you think is best suited to the job at hand. If you cannot easily switch between languages, then you didn't learn the concepts properly.

To that end, Java is a good first language. It has a gentle learning curve, but can teach you the advanced stuff as well. Not everything, but enough that you are able to switch to almost any programming language after a lesson or too in memory allocation.

I think I have a decent Java book at home, but I've forgotten its title. Will look at it for you tonight.

User avatar
juh
Posts: 156
Joined: Fri Dec 01, 2006 11:43 am
Location: Germany
Contact:

Thu Jul 31, 2008 6:13 am Post

matt wrote:But for a learner, it is a great help to get useful error messages rather than "Access violation" or "Seg fault", and it is a good tool to teach almost all aspects of programming, from the basics through to recursion, threads and synchronization, networking and sockets, design patterns like MVC etc.


I fully agree. Thats why the Python traceback is so informative that in most cases you don't need any debugger.

To be honest, people who rant against particular programming languages, or carry on about one being so much better than the other are pretty boring and usually wrong. Carrying on about Java being an "addiction" is just pathetic, and says more about the programmer than it does about the language.


Hey there is a kind of humour (and truth?) in it. ;-)

Pick a language, any language. Learn it well. Learn all the concepts you need to learn. Then as required, apply it to whatever language you think is best suited to the job at hand. If you cannot easily switch between languages, then you didn't learn the concepts properly.


Thats true.

To that end, Java is a good first language. It has a gentle learning curve, but can teach you the advanced stuff as well.


Java and Python share many concepts. It is certainly not wrong to learn Java as first language. But Python as a first language has some very neat advantages that it is worthwhile to have a closer look at it.

But my remark to the OP was just a BTW.

ma
matt
Posts: 1180
Joined: Mon Jul 30, 2007 9:35 am

Thu Jul 31, 2008 8:04 am Post

Fair enough, I must admit I haven't used python that much, so I couldn't remember how python stacked up in the debugging stakes.

And I understand it was an aside, I just wouldn't want the original poster to decide Java is inadequate and go chasing another choice, because that could be a merry-go-round you could stay on forever and never learn anything :)

More to the point, I mustn't have got enough sleep in the last few days. I appear to be starting spot-fires and minor arguments all over these forums.

Matt

User avatar
Jaysen
Posts: 6294
Joined: Mon Dec 17, 2007 4:00 am
Platform: Mac + Windows
Location: East-Be-Jesus-Nowhere SC, USA

Thu Jul 31, 2008 12:54 pm Post

Matt,

Are you attempting to enter the ranks of the +3+1? While we welcome the company the general rule is that you must devolve all mental processes to the level of a 6 year old. If you are up to we might be tempted to do a provisional +3+1+1/2 until you adequately prove yourself.

:twisted:
Jaysen

I have a wife and 2 kids that I can only attribute to a wiggle, a giggle, and the realization that she was out of my league so I might as well be happy with her as a friend. 26 years marriage later, I can't imagine life without her. -Me 10/7/09

ImageImage

User avatar
MarcustheBlacksmith
Posts: 220
Joined: Mon Sep 10, 2007 4:48 am
Location: Brisbane, Australia
Contact:

Wed Aug 06, 2008 1:24 pm Post

KB wrote:But on the other hand, SproutCore is based on Java, so Java may be pretty handy if you want to develop some cool web-based apps...


Actually, Sproutcore is a huge Javascript framework, not a Java library. It's being rolled into Apple's infrastructure to replace the old web apps, based on the Web Objects framework, which IS Java.

Mind you, I'm sure there's still a Java application or something similar running in the back end on the MobileMe servers. No matter how heavy-duty you make a client-side framework, at some point it's got to persist a whole heap of stuff efficiently on a server...and that usually means a Java application.

I'm all for this sort of model, actually. Scripting languages like Javascript are ideal for UI stuff, since you can easily grow and modify the interface as the requirements change (or on a whim). For the mission-critical stuff, where stability and performance is key, that's where something like JavaEE shines. The best modern client-server apps have Java business logic systems, which simply present a web-service, which the thick client/Javascript front end interfaces with.

And, it also means your public API is right there should you (or someone else) want to write alternate front ends...

So, um, moral of the story I guess, is if you want to learn Java, do yourself a favour and learn about web services, as well. You'll thank yourself later.

Regarding Python, I do love it as a language. And in fact in many projects I'd happily use it exclusively. However, this may surprise you but it performs much more poorly than Java. Google 'language benchmarks' and you'll be surprised - Java scores about a 1.8 in execution speed to the reigning number 1 (C). Python, on the other hand, executes about at 16 - approximately 8 times slower than Java, and about 16 times slower than an optimised C application!

For the most part, this goes unnoticed - most applications spend a lot of their time sitting around waiting for user input. But when it matters, it matters (such as processing a 6GB iTunes library, or downloading 3000 XML feed items).
sincères amitiés,
Monsieur Clangy Bangy

But t'weren't the Almighty that lifted her nighty...'twas Roger the lodger, the dodger!

User avatar
MarcustheBlacksmith
Posts: 220
Joined: Mon Sep 10, 2007 4:48 am
Location: Brisbane, Australia
Contact:

Wed Aug 06, 2008 1:46 pm Post

As has already been mentioned - the languages don't really matter if you focus on a strong basis in proper theory and practice.

Whichever language you choose, read up on the following concepts:

1. Design Patterns - especially the ever-useful Class Factory, Singleton, and Facade patterns.
2. Design by Contract.
3. Unit Tests. If you do nothing else, learn to write unit tests before you write your first application. Become a paranoid unit tester.

Basically, even if you are learning as a hobby and never intend to have someone else touch your code, you help yourself by writing code like a pro. It makes your work maintainable, extensible, and reusable, and you feel awesome, too, when you pull off that elusive 'bulletproof' class :-D

A good textbook to start with if you go via Java is 'Introduction to Programming and Object-oriented Design Using Java', by Jaime Nino and Frederick A. Hosch. It is a long book, precisely because they spend as much time easing you into professional standard programming as they do teaching you about language constructs. For example, you don't even use an if/else statement until Chapter 4 - and by that point you've already built, and tested, a number of different classes and design patterns.

For Python, Jonathon Zelle's 'Python Programming: an Introduction to Computer Science' serves a similar purpose. It isn't as verbose as Nino/Hosch, but it will definitely put you on the right track.
sincères amitiés,
Monsieur Clangy Bangy

But t'weren't the Almighty that lifted her nighty...'twas Roger the lodger, the dodger!

User avatar
KB
Site Admin
Posts: 20901
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Wed Aug 06, 2008 5:45 pm Post

...Which just goes to show how little I know about Java and Javascript (and the difference between them)...