SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    Non-Member
    Join Date
    Oct 2007
    Location
    United Kingdom
    Posts
    623
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Question Whats so great about Java?

    Hello, I have just started learning Java (Im a complete noob with Java) for my degree and I was thinking, what is so great about Java?

    Initially I thought Java wasn't all that great, just an over rated language that requires the user to download the apropriate software for it to even work. But all the new browsers have it built in allready (as far as I know) and there are no cross browser compatibility issues... When I thought about that, it was like the first sip of a cold beer after a long days work.

    So what I would like to know, is what makes Java so great?

    What can you do with it that you cant do with other languages?

    How heavily suported is it by browsers now?

    and finally, could you in theory make a stand alone Java program that you could sell on a CD, and would work on any computer?

    Will be good to hear your thoughts
    ro0bear

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ever heard of Limewire? Java program.

    Java is one of the most popular languages in commercial and open source use all around the world. Applets for websites are just a tiny fraction of its usage. It's probably second in use for building desktop applications only to C/C++ and .NET.

    Aside from being a mature language with a full library ready for enterprise development of just about anything, one of Java's primary benefits is that you write the code once and can run it on any platform. Java code is run in a Java VM, not compiled, and there are VMs for virtually every operating system, including many you've never heard of, and almost every cell phone in the world.

    It's particularly good for teaching in school because of its object-oriented nature, plentiful documentation and the fact that you can go out and get a job programming in Java anywhere in the world.

  3. #3
    SitePoint Zealot superjacent's Avatar
    Join Date
    Jun 2007
    Location
    Melbourne, Australia.
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm learning Java as well and now about to start the GUI stuff. At present my focus is geared towards the desktop. I think the underlying benefit is that you code once and deploy to any operating system. Maybe 'any' is too broad a term but the big three are certainly covered.

  4. #4
    SitePoint Wizard
    Join Date
    Apr 2007
    Posts
    1,398
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    this is one of many posts I've seen and this is what I learned. The real question is how should programming language be compared. Should it be by feature? should it be by it's philosophy? should it be by readability? should it be by number characters of the code? As you can see, people look at this differently and individual judges it differently. I've spoken to someone who is 100% convince that php is better because in java you have to type System.out.println vs print in other languages. So, please ignore the fools who thinks this way.

    To me, language should be judge by how easy it is to read someone else's code. After all, maintainance cost is the largest portion of big fund project. To reduce the maintainance, the code should be easily readable, easily to bug a problem, easily deploy, and etc... If there was self documenting language, then sign me up! I hate writing comments for the code but I believe one day we'll have such language. Anyways, so your question is "what makes Java special"? Well, back in the day where C++ was THE language to use, some people still hated it, why? pointers!. So, that's when Java came to the rescue and made programming a bit easier.

    They are both OO language but had difference in philosophy. Java relatively became popular when Java Applet came into play. Back then, if you mention any language w/ "web" then it became the next language to learn. Out of hype, applet was miserable failure. If it was successful then even google might've been applet..but it's not. Anyways, after people have learned it, they realized the potential of Java and focused on "Server" programming instead aka "J2EE". Probably Java is the first language that really took the web programming to completely different level. I would say it can be compared as the first language to reach the moon.

    For a long time, Java had 0 competitor and there are thousands of vendors supporting Java and still growing today! So now, what makes Java special is that you have all the "Java" library that's been built since beginning of 1990's. It's almost impossible to find what Java can't do. Also, if you search for any programming job, Java is easily #1. Why? because there are zillions of Java based application that needs to be supported. Also, it's a proven technology that probably tackle every issue ever existed since 1990. So, for non techy upper managment, they would pick Java as the language of choice.

    Ok~ so now why are other langauges like php, ruby on rails coming into play? Just like how C++ faded, there's people who hate Java. They think it's clunky, too complicated, learning curve is too high. So here comes new language that may be THE language for next gen. A lot of people like php and ruby on rails because they are simple to learn than Java. Some say you can develop faster in ruby on rails but that is completely 100% false. The speed of coding depends on the programmer!! not the language.

    Still, I do agree that Java is a language that takes years to master it. I've been doing it for 10 years and I still find many topics in Java unknown to me. I guess a good analogy would be that, Java is kind of like shopping at Home Depot. From the entire store, you pick your own tools that came out since 1990..there are many out there and still new tools are coming routinely. However, 1 tool can not complete a task on it's own, you need to get others and learn to use it efficiently. If a person gets frustrated because he simply wants to build a dining table for his family, you can goto Ikea (php/ruby on rails). They have special tools just to make a "dining table". Because they are specialized, it's easier to use. However, if you want to build a "refrigerator", you can't use those tools. Anyways, this post got way too big already... I would post more since it's Sunday night but I'll stop at this point. If you're looking to be a IT programmer than learning Java/.NET is a must.
    Last edited by sg707; Mar 16, 2009 at 07:39.

  5. #5
    SitePoint Wizard silver trophy rushiku's Avatar
    Join Date
    Dec 2003
    Location
    A van down by the river
    Posts
    2,056
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Dude, paragraphs are a wonderful thing, you really should try them.

  6. #6
    SitePoint Wizard silver trophy rushiku's Avatar
    Join Date
    Dec 2003
    Location
    A van down by the river
    Posts
    2,056
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    "What can you do with it that you cant do with other languages?"

    That I know of? Nothing.

    The real question, however, is: how many languages would I have to know to be able to everything that I can do with Java? (answer: many)

  7. #7
    SitePoint Wizard
    Join Date
    Apr 2007
    Posts
    1,398
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    this proves that readability is a important factor..lol

  8. #8
    SitePoint Zealot superjacent's Avatar
    Join Date
    Jun 2007
    Location
    Melbourne, Australia.
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sg707 View Post
    this proves that readability is a important factor..lol
    I was half expecting this response......lol

  9. #9
    SitePoint Wizard rozner's Avatar
    Join Date
    Oct 2002
    Location
    Paris
    Posts
    1,058
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dude, paragraphs are a wonderful thing, you really should try them.
    Seriously that was a painful due to lack of paragraphs...

    Anyway, I pretty much agree with what sg is saying. To answer some of roobeers specific questions...

    Initially I thought Java wasn't all that great, just an over rated language that requires the user to download the apropriate software for it to even work. But all the new browsers have it built in allready (as far as I know) and there are no cross browser compatibility issues... When I thought about that, it was like the first sip of a cold beer after a long days work.
    Java programs require a Java Virtual Machine (JVM) to run. Although a lot of systems come with a JVM preinstalled anyway. Otherwise it's not a big deal to install. I'd say it's about as easy to install as the Adobe Flash plugin.

    In terms of browser compatibility, there you're talking about Applets. Applets run on the client in their own container (similar to Flash) within the browser. So it doesn't matter what browser you're using, it will always look the same. That said... applet's are not that popular although they are still used in some major sites (i.e. Facebook's image upload thing is a Java applet).

    Then there's server side Java. Where the server and all the backend code is written in Java, also known as J2EE, or just Java EE now. With this it's no different than PHP or any other server language. In the end it's generating HTML responses to the client so you still have browser compatibility issues. Java EE is probably the most popular use of Java.

    So what I would like to know, is what makes Java so great?
    Well... the big advantage is the JVM. Which provides platform independence. I can write a Java program and it will work on any supported JVM. Which can be Windows, Mac OS, Linux, my cell phone, and many more.

    What can you do with it that you cant do with other languages?
    You can pretty much do anything with Java. Sometimes it's just a programmer's preference. These days I'll do just about everything with Java only because I know it better than any other language.

    How heavily suported is it by browsers now?
    I think I already answered this one.

    and finally, could you in theory make a stand alone Java program that you could sell on a CD, and would work on any computer?
    Yes, IBM ships several products that are written in Java. Rational Application Developer is just one example.

    There's also Azerus (bit torrent client) which is written in Java and of course the Eclipse IDE is written in Java. There are many more out there.

  10. #10
    Non-Member
    Join Date
    Oct 2007
    Location
    United Kingdom
    Posts
    623
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the responses. The fact that you can write it, and then it will run anywhere really is a breath of fresh air!

    It's obviously a very useful language to learn, especially if it is suported on "almost every cell phone in the world"; considering that mobile phones are regarded as the future. I presume only some of the old phones don't suport Java?

    Thanks, ro0bear

  11. #11
    SitePoint Wizard
    Join Date
    Apr 2007
    Posts
    1,398
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    not to ruin Java spirit, but some call sit "write once, test everywhere". In some sense, this is true.

  12. #12
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Write once, run anywhere is a reason why java is not so popular as it could.

    SWT in some cases is better then SWING.

    There is no "good" 3d API.

    Imagine if Java on Windows had 3D API (not Java3D but OpenGL bindings) then it is possible many games were written in Java and possibly it was ported to Mac and Linux.

    (There is .NET version for games that is fast enough for games)

    Now Sun decided to support native video codec in Java 7 as Java lost browser market to Flash/Flex and silverlight may take a second place.

    If Sun was not so much thinking about "everywhere" but created alternative to Windows on other popular platforms like Linux and Mac then may be we had Richer internet now. (no AJAX, no Flash/Flex, no Silverlight, BUT only Java)

    IT was possible to make OpenGL part of Java in early Java 1.1
    Imagine 3D applets 10 years ago!

  13. #13
    SitePoint Guru hgilbert's Avatar
    Join Date
    Dec 2004
    Location
    London
    Posts
    839
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Java is a language that has always eluded me.

    But not C#, I learnt that in under one week.

    I don't know why I could never get my head round Java, maybe it was the books I was trying to read and learn from.

    Method of learning has a lot to answer for.
    Find a good book or teaching resource and that thing you couldn't learn in decades, you end up mastering in almost no time.


  14. #14
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hgilbert View Post
    Java is a language that has always eluded me.

    But not C#, I learnt that in under one week.
    Congratulations, you know Java. The syntax is almost identical to C#. The difference is mainly what libraries are available (Java standard libraries vs. .NET libraries).

  15. #15
    SitePoint Zealot Mr. Ram's Avatar
    Join Date
    Nov 2005
    Posts
    139
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Platform-independent And Portable

  16. #16
    SitePoint Addict
    Join Date
    Jul 2006
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I learned java and jsp I purposely avoided GUI's. I wrote all code long hand, this is the best way to go. I do use netbeans as an ide. But I do not drag anything over, I type in all my code by hand.
    The GUI's throw in a lot of un-necessary code that becomes a resource hog.

    For example this bean:
    Code:
    package SQLBean; 
    // <&#37;@ include file = "util.inc" %>
    import java.io.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import org.apache.jasper.tagplugins.jstl.core.Out;
            
    public class DbBean { 
    String dbURL = "jdbc:mysql:///petback2";
    // String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver"; 
    // String upsql;
    private String t11;
    private int petid;
    private String petname;
    private String species;
    private String sex;
    private int ownerid;
    private String petowner;
    private String ostreet;
    private String dogpic;
    
    private Connection dbCon; 
    public DbBean(){ 
    super(); 
    } 
    public boolean connect() throws ClassNotFoundException,SQLException{ 
    Class.forName("com.mysql.jdbc.Driver");
    dbCon = DriverManager.getConnection(dbURL, "root", "hidden"); 
          
        
    // Connection dbCon = null;
    // Class.forName("com.mysql.jdbc.Driver");
    // dbCon = DriverManager.getConnection("jdbc:mysql:///petback2", "root", "hidden");
        
    // Class.forName(dbDriver); 
    // dbCon = DriverManager.getConnection(dbURL); 
    return true; 
    } 
    public void setpetid(int petid)
    {
    this.petid = petid;
    }
    
    public int getpetid()
    {
    return (this.petid);
    }
    public void sett11(String t11)
    {
    this.t11 = t11;
    // this.message = message;
    }
    
    public String gett11()
    {
    return (this.t11);
    }
    public void setpetname(String petname)
    {
    this.petname = petname;
    // this.message = message;
    }
    
    public String getpetname()
    {
    return (this.petname);
    }
    
    public void setspecies(String species)
    {
    this.species = species;
    // this.message = message;
    }
    
    public String getspecies()
    {
    return (this.species);
    }
    
    public void setsex(String sex)
    {
    this.sex = sex;
    // this.message = message;
    }
    
    public String getsex()
    {
    return (this.sex);
    }
    
    public void setownerid(int ownerid)
    {
    this.ownerid = ownerid;
    }
    
    public int getownerid()
    {
    return (this.ownerid);
    }
    
    public void setpetowner(String petowner)
    {
    this.petowner = petowner;
    // this.message = message;
    }
    
    public String getpetowner()
    {
    return (this.petowner);
    }
    
    public void setostreet(String ostreet)
    {
    this.ostreet = ostreet;
    // this.message = message;
    }
    
    public String getostreet()
    {
    return (this.ostreet);
    }
    public void setdogpic(String dogpic)
    {
    this.dogpic = dogpic;
    // this.message = message;
    }
    
    public String getdogpic()
    {
    return (this.dogpic);
    }
    
    
    
    
    
    
    public void close() throws SQLException{ 
    dbCon.close(); 
    } 
    public ResultSet execSQL(String sql) throws SQLException{ 
    // PreparedStatement s = null;
    // String sql = "SELECT petid, petname, species, sex, ownerid, petowner, ostreet, dogpic FROM pets WHERE petname like ? ORDER BY petname LIMIT "+ currentRs +",5";
    try
    {
    PreparedStatement s  = dbCon.prepareStatement(sql);
    s.setString(1, this.t11 + "%");
    ResultSet r = s.executeQuery();
    // System.out.println("here is s ====" + r);
    /* if (s != null)
        {
        s.close();
        } */
    // r.close();
    // s.close ();
    return (r == null) ? null : r;   
    // PreparedStatement s = null;
    
    
    }
      catch (SQLException se)
      {
        // log exception;
        throw se;
      }
    
    
    
    
    /* Statement s = dbCon.createStatement(); 
    ResultSet r = s.executeQuery(sql); 
    return (r == null) ? null : r; */
    } 
    public int updateSQL(String sql) throws SQLException{ 
    Statement s = dbCon.createStatement();
    int r = s.executeUpdate(sql);
    // s.close();
    return (r == 0) ? 0 : r; 
    } 
    public ResultSet exeSQL() throws SQLException{ 
    String sql = "SELECT count(petid) FROM pets WHERE petname like ?";
    try
      {
        PreparedStatement s  = dbCon.prepareStatement(sql);
        s.setString(1, this.t11 + "%");
        ResultSet r = s.executeQuery();
       // r.close();
        // s.close ();
        return (r == null) ? null : r;   
        
    }
      catch (SQLException se)
      {
        // log exception;
        throw se;
      }
    
    } 
    
    public ResultSet editSQL(String sql) throws SQLException{ 
    // PreparedStatement s = null;
    // String sql = "SELECT petid, petname, species, sex, ownerid, petowner, ostreet, dogpic FROM pets WHERE petname like ? ORDER BY petname LIMIT "+ currentRs +",5";
    try
      {
    PreparedStatement s  = dbCon.prepareStatement(sql);
    s.setInt(1, this.petid);
    ResultSet r = s.executeQuery();
    // s.close ();
    return (r == null) ? null : r;   
    }
      catch (SQLException se)
      {
        // log exception;
        throw se;
      }
       
    /* Statement s = dbCon.createStatement(); 
    ResultSet r = s.executeQuery(sql); 
    return (r == null) ? null : r; */
    } 
    
    public int updatepet(String sql) throws SQLException{ 
    PreparedStatement stm = null;
    int ri = 0;
        try
        {
        stm = dbCon.prepareStatement(sql);
        // (petname, ownerid, petowner, species, sex, ostreet, dogpic)
        stm.setString(1, this.petname);
        stm.setInt(2, this.ownerid);
        stm.setString(3, this.petowner);
        stm.setString(4, this.species);
        stm.setString(5, this.sex);
        stm.setString(6, this.ostreet);
        stm.setString(7, this.dogpic);
        stm.setInt(8, this.petid);
        ri = stm.executeUpdate();
        stm.close();
        
        }
        catch(Exception e){
        System.out.println("Exception is ;"+e);
        }    
       
        
    // Statement s = dbCon.createStatement();
    // int r = s.executeUpdate(sql);
    // return (r == 0) ? 0 : r;
    return (ri == 0) ? 0 : ri;
    } 
    
    }
    is typed by me, not generated by nothing.
    Last edited by jim9; May 18, 2009 at 14:12. Reason: spell

  17. #17
    SitePoint Zealot superjacent's Avatar
    Join Date
    Jun 2007
    Location
    Melbourne, Australia.
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jim9 View Post
    When I learned java and jsp I purposely avoided GUI's. I wrote all code long hand, this is the best way to go. I do use netbeans as an ide. But I do not drag anything over, I type in all my code by hand.
    The GUI's throw in a lot of un-necessary code that becomes a resource hog.

    For example this bean:
    Code:
    package SQLBean; 
    // <%@ include file = "util.inc" %>
    import java.io.*;
    ...snip...
    is typed by me, not generated by nothing.
    I noticed you've edited your post once for spelling reasons and therefore you may want to address the bolded text above. I know what your intent is but the literal meaning of your comment is that the code was generated by something. That something could be a GUI component.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •