Which programming language is the best ?

In summary: But for the most part, Java is a very platform-independent language.In summary, Java is a versatile language that is easy to learn but can be slow because of its virtual machine. C# is a more powerful but slower language. Depending on the problem you are trying to solve, Java may be a better choice.
  • #1
ngkamsengpeter
195
0
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 .
 
Technology news on Phys.org
  • #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.
 
  • #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
 
  • #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.
 
  • #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:
  • #6
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.
 
  • #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 development 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.
 
  • #8
haki said:
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.
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.
 
  • #9
Yeah, if you learn Java you must learn OOP but hey OOP is de facto standard of todays software development anyway and it makes you write more cleaner and more reusable software.

I find "makes you write cleaner and more reusable software" just about as unresearched as "Java is slow".
 
  • #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:
  • #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.
 
  • #12
haki said:
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.
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.
 
  • #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.
 
  • #14
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:
  • #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?

Thanks.
 
  • #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 as well 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) ...
 

1. Which programming language is the best for beginners?

The best programming language for beginners depends on their personal interests and goals. Some popular options for beginners include Python, Java, and JavaScript.

2. Which programming language is the most versatile?

There is no single programming language that can be considered the most versatile. Each language has its own strengths and weaknesses and is better suited for certain tasks. Some commonly used versatile languages include Java, Python, and C++.

3. Which programming language is the best for web development?

Again, the best programming language for web development depends on the specific project and the developer's preferences. Some popular languages for web development include HTML, CSS, JavaScript, and PHP.

4. Which programming language is the best for data analysis?

For data analysis, languages like Python, R, and SQL are commonly used. Each of these languages has its own libraries and tools specifically designed for data analysis tasks.

5. Which programming language is the best for creating mobile apps?

Mobile app development can be done with various languages, but some of the most popular options include Java, Swift, and Kotlin for Android development, and Swift and Objective-C for iOS development.

Similar threads

  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
Replies
18
Views
2K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
7
Views
633
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
14
Views
2K
Back
Top