Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Which programming language is the best ?

  1. Mar 1, 2007 #1
    I want to write a cross-platform program but I wondered which programming language should I use ? I know java is cross-platform but it is difficult to learn . php gtk is much more easier but it is based on php so what php gtk can't do but java can ? What is the cons and pros of php gtk and java ?
    Please provide some tutorial on php gtk for me , thanks .
  2. jcsd
  3. Mar 1, 2007 #2
    Thats a bit like saying what spoken language is best.
    Certain languages are written for specific functions therefore Fortran is used for Mathematics, ADA is used for safety critical applications, VB is used for database manipulation, Matlab is used for mathematical matrix manuipulation. You need to look at what your application is before selecting the language best suited to it, who will use it, who may want ot modify it, what it has to interface with.
    Of course that only works if you are making really tight code and you have knowledge of all/no programming languages. I'm sure that some of my reports could be better written in Japanese but I don't speak it therefore it is going to be easier to write them in English. The best language is also the language you can work in.
  4. Mar 6, 2007 #3
    If you are seeking a simple language that is cross platform, the following shall do:

    Perl, Python, Ruby,

    or another scripting language that is similar. Google these languages. If you want something more powerful, the following shall do:

    .Net or Java
  5. Mar 9, 2007 #4
    What kind of problem are you trying to solve? What do you expect from such language?
    I'm seeing some confusion about php, gtk and java. Java and php can be considered equivalent but gtk is not a language but a library, and it is implemented in C but can be used with other several languages including C++, python, perl, ruby, etc.
  6. Mar 10, 2007 #5
    Usually if it is for cross platforms, Java is the best. You can use it on web sites, cellphones, PC, Unix, etc. However, there will always be a downside for such convenience. Java runs under a software known as virtual machine which this program runs under the original Operative System. It is like a software inside another. Because of the way Java run it's applications, it is a lot slower than other programming languages.

    Visual C# uses a similar idea to Java so it also is slow. I think that Visual C# has some cross platform comparability too. (Correct me if wrong)

    Like it was said before, it depends what you want to do and what platforms you are planing to make it for. If it is web only applications you can use scripting languages and web applications ca be used cross platforms though a web browser.

    Edit: Is Java that really hard? It seemed to be much easier than C++ since it was better cleaned up.
    Last edited: Mar 10, 2007
  7. Mar 10, 2007 #6


    User Avatar
    Science Advisor

    Java is substantially easier than C or C++ in my opinion. Once you get the idea behind Object Oriented programming, which is essential, the rest is very straightforward.
  8. Mar 11, 2007 #7
    Sorry but I could not help it:

    How the F^@$ do you know that Java is slow? Did you do benchmarks? It really pisses me off when people say that, ok when Java first came out version 1.0 you could say that it was slow, but version 5.0+ is quite fast enough.

    Yeah, if you learn Java you must learn OOP but hey OOP is de facto standard of todays software developement anyway and it makes you write more cleaner and more reusable software.

    C# does have cross-platform functionality (Mono) but I would not consider it as a robust solution. I have some .net experience, my advice is stay away from .net and C#, yeah things do look nicer, yeah you probably get 80 % of program done more smoothly under C# but hey the last 20 % is where things start to get ugly. In Java if you need something complex done, you can choose from N robust open source libraries that do the job for you.

    Java is nice and simple language, one of the reasons you see it as a language for programming lessons at universites around the world.
  9. Mar 11, 2007 #8
    Point is that Java is an interpreted language. An interpreted language can never be faster than a language like C which compiles to executable code.

    But with JIT compilation technology you can come a long way, and in very limited cases, you could optimize the code even better than an offline compiler possibly could. :smile:

    Now, obviously if you mostly use platform dependent executable libraries, for instance graphics or networking, then the speed difference would be minimal.

    By the way, I am a big fan of Java.
  10. Mar 11, 2007 #9


    User Avatar
    Homework Helper

    I find "makes you write cleaner and more reusable software" just about as unresearched as "Java is slow".
  11. Mar 11, 2007 #10
    Of course, Java is NOT rubbish at all. It has its own good uses and all. But a fact is a fact. No matter how cleaned up the language is, if you write big applications, performance is a very important factor. I mean, you wouldn't want to wait twice as much as it could usually take (if programmed with other languages), would you? There are times that speed doesn't matter, but there are others that time is crucial.
    Last edited: Mar 11, 2007
  12. Mar 11, 2007 #11
    Yeah, that is what I had in mind JIT and some other stuff. Btw: if Java would be really that slow I doubt very much that large corporations would consider running their software on Java EE servers. But yeah for some complicated computations Java is not the best choice but for the rest I think it runs resonably fast(largely due to JIT and othe stuff).

    Imagine doing a web pet store application, where do you think that the code would be more readable and maintainable if written in an OOP language like Java or in some procedural language? Where would be easier to "copy-and-paste" code and use it on let say book store application? Provided that both programmers have similar experience. Where would be easier to make unit tests?... If you ask any ("good") programmer he/she will say OOP is the best thing that ever happend, but some will not say it so openly but they would agree.

    I am a big fan of Java to.
  13. Mar 11, 2007 #12
    That depends.
    A game programmer busy with optimizing critical sections could not care less with needless OO overhead, while a programmer who wants to write extensible and reusable code is obviously very concerned with OO implementations.

    Nothing wrong with object oriented programming, but in some type of applications there is simply no need for it.
  14. Mar 11, 2007 #13
    True. It is not only about getting the applications to work at full potential, but also to get the applications done in the time that it is needed. Also, unlike binary compiled codes, Java compiled code can be decompiled to its original source code.
  15. Mar 11, 2007 #14


    User Avatar
    Science Advisor

    Java has a reputation for being slow, but that is not as true now with Just In Time (JIT) compilation.

    With JIT the bytecode that would otherwise be interpreted by a virtual machine is instead compiled into native machine code and cached, so that the app can be run as a native application and not through the virtual machine.

    A drawback of this is that there is the initial delay of having to compile the byte code to native machine code. However, any subsequent runs of the program can run pretty fast (you still have the garbage collection overhead).

    If you have ever coded any ASP.NET applications you have probably seen the JIT compilation delay every time you update a library, which is typically a few seconds, but any subsequent runs are very fast.

    This is one of the reasons why .NET and JAVA technologies are so popular on web servers. Because they target a specific server they can be compiled to target the server's hardware architecture and Operating System. The JIT delay is a couple of seconds on the first http request out of possibly millions, so it's negligeable, and you get the OOP advantage, which implies better coding practices and is more suitable for large scale projects being worked on by large teams.

    One of the biggest issues of these technologies is security.
    Last edited: Mar 11, 2007
  16. Mar 11, 2007 #15
    It is true if the main application is left running; and therefore, it will be stored in the main memory (RAM) which is substantially faster. But if the server doesn't have enough memory it would be a problem. Otherwise, if there is more than enough memory, it won't be a problem at all. That is why to get out best of Java applications still depends on what it will be used for.

    Anyway, it is true that one of the most important things about applications is security (especially for network applications that do transactions, etc). And Java is very famous for having strong security. But i am a little confused about it so can you explain how the security in Java works? I mean what i have in mind is that if you know how the application works, you can bypass the security right? But then Java compiled code can be reversed to it's original source code unlike binary applications. Then where does the security lies on?

  17. Mar 12, 2007 #16
    There is Ahead of Time compile aswells there is JIT.

    For security: Yeah bytecode can be easily decompiled but there are tools called obfuscinators, they make the bytecode close to imposible for a human to read while the obfuscinated code produces the same results on the VM as non-obfuscinated. So Java code cannot be easily decompiled.

    In Java environment security is very important aswell, that is there is "security" on VM level. For instance if you run unsigned web start application Java VM will not allow the code to access the file-system unless authorized by the the user. Aswell the code cannot access memory outside what the VM has allocated to the program(buffer overflow). btw: the VM also does memory (de)fragmentation.

    There is aswell programatic security:
    Even if you know how security works, if it is properly done, you still need to know some passwords. For instance supose you wan't to get some files on a "secure" server. Now if security is done right, then even if you know the location of the database and even worse you know the location and password of the database that the program uses to verify passwords it is useless since the database will only allow to be acceessed from a specific IP and MAC address and maybe some other things. Java makes it very easy to write secure code, it has extensive libraries that provide cryptographics services and libraries for secure communication (SSL) ...
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Which programming language is the best ?