1
How to determine the most appropriate programming language for a given function?
For example, for AI development Python is more efficient than Java.
1
How to determine the most appropriate programming language for a given function?
For example, for AI development Python is more efficient than Java.
8
It’s hard to answer that, but I see an opportunity to clear up a few things that might be useful to a lot of people.
Beginning with:
for AI development Python is more efficient than Java
Why? There are reliable sources on this?
Python is one of the least efficient languages that exists, I don’t know why AI would be different. I’m considering that the question has a tag performance.
It does not mean that Python is not suitable, that it does not have its merits and even less that it is not used for this. They are socio-cultural-political reasons that make Python be used for this and create the perception that it is good in this regard. I like Python better than Java (for some things), but I can’t say it’s more efficient.
Even because efficiency lacks definition.
There are two principles (since you have this in the question, although I think it was misplaced) that govern the choice of a tool in computing and other areas:
Actually trying to use an unfamiliar tool is not a good idea. The right thing is to learn the tool before using and learning well. For most tasks the tool is not so important, the user of it matters, so a good developer will solve the problem well with any one that is not absurdly out.
The problem is that usually the person who will do something does not know well any tool, then complicates. Who knows well one of them usually has no problem learning others well. Not that this is always desirable.
There are cases that the tool is chosen for an exclusively technical reason, in general because of the platform where it is being used.
Assembly is used when you need to do something that no other language can do, when you need to directly access the hardware, boot something with nothing to help. Contrary to popular belief it is not used to achieve maximum performance, at least not in most cases. In theory, Assembly allows the best performance, but in practice it is rare to achieve this, and when it does it is at the cost of a lot of effort.
If you’re gonna make a query in a relational database will probably use SQL, which is not a programming language, but T-SQL or PL/SQL are, and these languages only work on a specific platform and do not usually use anything else.
Today, it will be done frontend web has a great chance that will use Javascript. But there are other languages that can generate JS for you. There are reasons to prefer Typescript, for example. Today any language can be used, since it Compile for Webassembly. For current needs to run JS web applications is no longer so appropriate.
If you have an ERP, a customizable game, a niche operating system with limitations, or other software with a specific, perhaps proprietary language, it’s that proprietary language you’ll have to use.
If you are going to do something for an embedded device, with limitations, or is an operating system, then C, C++ or even Rust should be the most suitable, each with its advantages. If you’re gonna make a driver also, need to access the resources at the lowest level.
If you are going to run on Android it is likely that Java or Kotlin are much better options than anything else. But C# and other languages can also be used without major problems and even with advantages in some cases.
Whether it’s for iOS, Swift, or even Objective-C might be the best options, but C# and other languages do well too, or even better in certain scenarios.
If you are going to do desktop GUI for Windows it is almost certain that you will get a good return with C#, but virtually all languages work well, because it is the library that makes the difference. If you want to make GUI with Java, gives, works, but probably does not look good on any platform, the language has chosen to work at all, not work well somewhere (there are options that help this, but it is not the standard and has its problems there).
If an API you need to use is available for C# and nothing else, it’s the one you need to use.
So far the choice has always been on top of the platform, this helps decide almost every time.
So if the AI API or the platform you’re running requires Python, Java, or other language, it’s up to you to choose.
If you are going to do something fast, small, that will be used a few times, for your consumption, that is, it is a script, can use almost any language, but probably the operating system shell language is the best choice, it can be batch DOS, Bash, Sh, Powershell, or more general languages like Perl, Python and others. Nothing prevents doing in C or Java, but for what? Code called throw away need to be developed quickly, even if they are not as robust and achieve good performance.
If you’re gonna do backend web has great chance of the best options being C#, Java, PHP, Python, Ruby or Javascript. But why not Moon, Delhi, Rust, D, Go, Harbour or BASIC? These early languages are better because they have more and better libraries to handle web.
R or Matlab are great languages for statistics and mathematics, they are niche languages, they are not good for some tasks, but great for those that have been designed.
Fortran may be a better option for scientific applications.
There are phone companies that can’t work without Erlang.
An intricate and probably poorly made legacy system may require a new project to be done in COBOL to conform to the previous.
If you need a specific performance you may have to choose a language that helps you do it, that runs fast, that runs without breaks (no garbage collector or other type techniques), that starts fast, does not block execution (asynchronous)etc. That’s why games are made primarily in C++, but are changing.
There are situations that cannot release the sources or cannot generate an executable, and this can be a limiter that eliminates multiple languages. There are cases where you don’t have a complicated installation, you can’t have Dlls, you can’t have certain dependencies, like maintaining a running environment, or you have some requirement that a language doesn’t meet. PHP itself can even be used for other things, but anything other than backend web will bring a very bad result for lack of good resources for other tasks.
There are problems that fit well in the imperative paradigm, others in the functional. There are cases where object orientation can help organize the code better and the language having a good mechanism for it will be useful. A language that has certain design patterns in the language can give a slightly better productivity.
If the team you joined uses one language, you can hardly use another.
Certainly I could continue listing examples here. But most problems matter little what you adopt. Here comes the situation that the best tool is the one you master.
Liking a tool helps motivate the person and this is good for productivity. But it doesn’t work well at all. For example, the people who most need a static typing language are the ones who most dislike this type of language.
Most of our work is not in the programming language. Well, for some it is, because the person does not plan, is having to get problems all the time, but even in these cases may still have to use a lot of time off, for example asking in the OS how solves the problem that she does not understand, or stay in the Debugger.
If you can’t determine on your own, you have to ask someone who is experienced (in quality, not in number of years doing something) what is best. If it is a good source it will explain why. But beware because one can give an explanation that looks great for a layman in that, but is not.
Often the error comes before choosing the proper tool. For example, you have to do an ERP and the person choose to do for web. It is already wrong, then any decision will be wrong. But people are lucky, we live a time when sub-optimal solutions are accepted in the market. So most of the time choosing the wrong language will not bring big problems. I prefer to choose the right one.
I see a lot of people wanting to do a certain way, for example they want to object-oriented programming, but it has no basis whatsoever of what that even means. In a case like this what difference does one choose the right or wrong language?
You don’t build the understanding of which language is appropriate by asking this, but you learn all the other aspects of computing to make sure you can make the decision properly. If you’re not a meat expert, you’re going to buy three pounds of picanha, thinking you’re doing business, or you’re going to buy a two-pound piece and think it’s a sure thing. Only those who really know can evaluate, have no universal metric to answer. Maybe only a meat expert will understand the analogy :)
Browser other questions tagged performance characteristic-language software-architecture language-independent
You are not signed in. Login or sign up in order to post.
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero