Author Topic: Quick guide to Java?  (Read 10968 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Quick guide to Java?
« Reply #15 on: November 22, 2010, 12:03:31 am »
Don't worry, I'm gonna make sure this won't turn into a language wars. Check forum rules #2 anyway (I guess 1 might apply too)

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Quick guide to Java?
« Reply #16 on: November 22, 2010, 12:26:45 am »
This is for the FIRST robotics competition.

Is it the season already? That means that I've been slacking as a mentor... :P
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline calcforth

  • LV3 Member (Next: 100)
  • ***
  • Posts: 62
  • Rating: +4/-4
    • View Profile
Re: Quick guide to Java?
« Reply #17 on: November 22, 2010, 04:27:49 am »
This is for the FIRST robotics competition.
I was informed of two choices - Java or C (maybe C++?  One of the C's)
All things being equal C++ will be better choice. Of course things rarely are equal :(
I have no experience in Java - but the team (which I just joined this year) is reusing the bulk of the program from last year, which was written in Java (because one of the seniors last year knew Java).
Well, if they already have something working then it's not a good idea to start total rewrite in different language. It's rarely a good idea in general, but especially when you are competing with someone.
I would love to use Python, but I have no idea how to get a python environment working.
Python is worse then Java in many aspects. It very nice to program, but quite slow. The one thing which is fast in Python and slow in Java is C/C++ interface.
I had to go to a presentation this Saturday just to learn how to get Java/C++ running.
My advice WRT to Java/C++ integration: don't try to push small pieces of task to C/C++. JNI is very slow by design: because it must do lot's of thing WRT GC (objects must be compacted and frozen, etc), so while C/C++ procedure may be faster then Java the switch from C/C++ and back will often eat all adavantages of such hybrid approach.
I don't care much about the detriments of Java, especially because I don't have any viable alternative to present and because I'm not experienced+eloquent enough to communicate the difference well.
You must keep them in mind if you want to write competive Java program. It's very easy to lose track of things in Java - and this leads to tons of unneeded work in runtime. It's possible to write good program in Java, but sadly Java encourages mindless programming so you must resist.

Also, don't forget about the biggest advantage of Java: powerful IDEs. Two top free ones are Eclipse and NetBeans. Two top paid ones are IntelliJ (it has free community version and classrom license) and JBuilder (very powerful but also very expensive). My advice: don't try to program Java without help of IDE (VIM and emacs with bunch of addons can be considered an IDE but only make sense if you were avid VIM/emacs users before trying Java). This is greatest strength of Java and a reason for it's continuing existence.

Also: ask around for what other members of team are using. Often it's easier to use the same IDE as others are using rather then using superior (in your opinion) IDE which does not play well with changes made by others.

And last but not least: learn some version control system if you still have time! My preference will be Git - but only if you are using Eclipse or IntelliJ: NetBeans and JBuilder have unofficial modules (development of official NetBeans plugin started just recently) thus intergration is not as good. But again: talk with other members of a team.
« Last Edit: November 22, 2010, 04:29:42 am by calcforth »

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Quick guide to Java?
« Reply #18 on: November 22, 2010, 06:50:09 am »
The best guide I ever read for Java was Thinking in Java by Bruce Eckel. http://www.mindviewinc.com/Books/TIJ4/PurchaseBook.php
As an "IDE", I use Notepad++ http://notepad-plus-plus.org/ It has hilighting for C,C++,Java, and a ton of other languages as well. It is also small, and can be run from a flash drive.
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline calcforth

  • LV3 Member (Next: 100)
  • ***
  • Posts: 62
  • Rating: +4/-4
    • View Profile
Re: Quick guide to Java?
« Reply #19 on: November 22, 2010, 07:14:13 am »
As an "IDE", I use Notepad++ http://notepad-plus-plus.org/ It has hilighting for C,C++,Java, and a ton of other languages as well. It is also small, and can be run from a flash drive.
Notepad++ is fine editor, but it's not an IDE. Good Java IDE includes "code-sense": it detects errors as you type your program, proposes changes to it if you are doing something in suboptimal way, etc. This is what makes it possible to use Java for "monkey programming". The only problem here is the fact that it's not omnipotent and it's suggestions are helpful about 90% of time and the other 10% of time you should say "no" to it's hints. And it only knows simple patterns - it'll never propose to replace hash with rb-tree (or the other way around). Still it's useful tool if you use it as a suppllement to your own brain and not as a replacement for it.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Quick guide to Java?
« Reply #20 on: November 27, 2010, 09:48:11 am »
IDEs (or at the very least, editors with syntax coloring) are nice to use Java indeed... but probably only after one knows several basics, e.g. command-line java and javac, the CLASSPATH :)
On Thursday afternoon, at work, we lamented about the high proportion of students who learned Java only under Eclipse/Netbeans, and are lost without that foundation... Such students can be completely incapable of debugging simple NoClassDefFoundError-type problems, which arise during their internships if they're using external libraries.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.