Jumat, 04 November 2011

How To Becom a Java Programmer


Tools all in place for programming: computer, carbs, caffeine

To become a Java programmer, you need a "compiler", a program to convert Java source code to bytecode. In the old days, the only option was Sun's Java Development Kit; but now you have many options, including the GNU project's gcj which creates class files or native executables, and jikes, IBM's open source contribution. You also will need a Java virtual machine, which is a "machine within a machine" which understands Java bytecodes and translates them into machine language on the target processor. There are many available, but you can never go wrong with the javac compiler and java JRE virtual machine included with Sun's Java standard edition


  1. Visit Oracle's Java SE download page and download the correct package for your platform: typically Windows, Linux, or Solaris. Macintosh users will find they already have the J2SE installed. For maximum portability, it may be better to get an older edition; not all your potential users will have the latest JVM installed. Alternatively, use an open-source or other third-party compiler such as gcj or jikes, and compile to a native executable or run it with the Java JRE.
  2. Learn to use a basic, "clean" editor like Notepad, vi, or emacs. These don't taint your program source with formatting information as does, for example, Microsoft Word. Whatever editor you use must have the option to save as "plain text".
  3. Learn the basic edit-compile-test cycle:
    1. Create or edit the program source file(s).
    2. Compile to .class files.
    3. Run the program with the java executable, or as an applet in a browser. If the functionality isn't correct, or you want to add more features, start again at step 1.
  4. Compile and run a simple Hello World! application to get familiar with the process.
  5. When you run into a snag, a large number of problems and their solutions can be found with a search engine, like Yahoo! and Google. Make good use of this extraordinary resource.

TIPS
  • Buy a basic book on Java programming. One can often find older editions for a very low price at thrift shops, library used book sales, and online auctions or booksellers. Though the online API docs, articles, and troubleshooting tips are usually available to you, a book is often more convenient, and can be perused while commuting by bus, sitting in a bar or coffeeshop, and for a little light reading before going to sleep.
  • For specific info on the classes, methods, and variables, visit Sun's API documentation. It might also be a good idea to download it to your hard drive in case you lose Internet connectivity.
  • After you master the basics, start a programming project that means something to you, or join an existing open source project and work together with other people.
  • Keep your code organized, and add plenty of comments for easy reading, remembering, and updating.
  • Unnecessarily long methods (the Java name for subroutines) are looked down upon since they make your code hard to read and difficult to update; learn to factor your code into small, precise modules that do one thing well.
  • Don't use "magic numbers": numbers and values that are distributed through your code when they should be defined as a constant, e. g.:
    static final int HTTP_PORT = 80; // server port for HTTP (web) service
    
    This way they can be reused, and explained in a comment so what they represent can be understood; making your code easier to maintain and update.
  • Optionally, download and install an IDE (Integrated Development Environment). For example: NetBeans or Eclipse (open source). This will help speed up the edit-compile-test cycle, at the expense of extra overhead, having to learn a new tool, and limited functionality. Another option is a text-based tool such as GNU Make or Apache Ant, which gives you full control over the process.


Source and Citations

Source:
    http://java4all.info/corejava/interview-questions/java-interview-questions.htmlhttp://java.sun.com/javase/This research was made possible, in part, by a land grant from the City of the Sun, though the specifics of the research were not coordinated nor endorsed by COSF. 

Tidak ada komentar:

Posting Komentar