Javascript-questions about multilingual programming?

Source: Internet
Author: User
Experienced elders advise new users who ask which language is the most powerful. It is often said that a system uses multiple languages and that putting all languages in the fields they are good at is the best. At the same time, some predecessors often say that because PHP is easy to deploy and the development efficiency is high, it is used to handle the business logic, while some experienced predecessors advise various questions. Which language is the most powerful?New users often say that a system uses multiple languages, so that all languages are best placed in the fields they are good. At the same time, some predecessors often say that, because PHPIt is easy to deploy and has high development efficiency, so it is used to process the business logic. Distributed, ParallelAnd so on. javaImplementation, involving Data ProcessingOther python. However, it is useless to mention the specific design method.

So here, how can we design a system in multiple languages?

Based on my personal superficial knowledge, I have come up with two solutions.

  • ExploitationC/C++At the underlying layer, modules written in different languages are connected. But intuition tells me this is unscientific.

  • The modules in different languages are designed into the C/S mode, and socket interaction is used between modules. However, the efficiency is not high, and if all modules can be deployed on the same machine, should we also design it into a C/S model?

I have already asked the mother-in-law, but I can't find the desired answer. I am here to ask questions. I hope the seniors with relevant experience can share their experiences. If you can give more information, thank you very much!

Reply content:

Experienced elders can ask questionsWhich language is the most powerful?New users often say that a system uses multiple languages, so that all languages are best placed in the fields they are good. At the same time, some predecessors often say that, becausePHPIt is easy to deploy and has high development efficiency, so it is used to process the business logic.Distributed,ParallelAnd so on.javaImplementation, involvingData ProcessingOtherpython. However, it is useless to mention the specific design method.

So here, how can we design a system in multiple languages?

Based on my personal superficial knowledge, I have come up with two solutions.

  • ExploitationC/C++At the underlying layer, modules written in different languages are connected. But intuition tells me this is unscientific.

  • The modules in different languages are designed into the C/S mode, and socket interaction is used between modules. However, the efficiency is not high, and if all modules can be deployed on the same machine, should we also design it into a C/S model?

I have already asked the mother-in-law, but I can't find the desired answer. I am here to ask questions. I hope the seniors with relevant experience can share their experiences. If you can give more information, thank you very much!

Thrift or restful is a regular multi-language glue solution

There are two common cross-language approaches. One is based on the SOA architecture. Services can be written in multiple languages, but interfaces are unified. The client can also be written in multiple languages. You only need to call a unified service interface. A typical example is a variety of development interfaces, such as Weibo and other development interfaces. Calling SQL in a program can also be considered in this type.

Another method is the common method of providing secondary development scripts. In a program, a set of APIs are provided for customers to develop plug-ins based on this API, such as VBA in Office.

In fact, the most common multi-language development is actually a Web page. Generally, HTML, CSS, and JavaScript are used together for development at least. Even if you don't treat CSS as a language, HTML and JavaScript are always a language, besides, there are CSS preprocessing languages such as LESS.

In the past, compilation in C/C ++ often happened, but it is rare now.

Do not use multiple languages for the purpose of using multiple languages. Cooperation with multiple languages also requires costs. Sometimes, if you can use one language, you may not have to use multiple languages to do what you are good.

The key is what system you are working on. If you know the characteristics of each language and the existing class libraries, you probably know how to choose based on your business.
1) C ++ must use C ++ to pursue the ultimate performance, and the performance should not go right. The disadvantage is that the development efficiency is low. Let alone java is faster than C ++, it is based on the low level of C ++ programmers and is not optimized. trial areas: graphic image processing, game Background Development, the reason: No GC, no delay, imagine what kind of bad experience is when you build a game backend server with GC on the server that causes choppy for dozens of milliseconds on the client. At present, many mobile games are also using java, but mobile and client games are two things.
2) If you do not have so strict requirements on latency for web or other java applications, this is a good choice. The performance is close to that of c ++, and the development efficiency is not so low, A lot of class libraries and frameworks can be used. Whether it is web or big data, java is a good choice. Even if you don't like java, there are a lot of jvm-based languages to choose from. For enterprises, it is much easier to recruit a working java program than to recruit a similar C ++ program. After a few months of training, you can start to write java. This is absolutely impossible for C ++, after writing C ++ for more than half a year, I still don't know what is the compilation period and what is the runtime period.
3) scripts, such as PHP and python, can be easily written. With a bunch of examples on the internet, barabara can write an example that can run at the minimum granularity, the best choice for small companies, and python is also a glue language, either on JVMs like jython or. net implementation, the syntax is also very easy to use, so there are a lot of python.
4) Others, such as C # and Delphi, are not commented.

The plan cannot keep up with the changes. I think there are too many things on the floor. In fact, there is no need to be so meticulous. First, you need to deploy multiple languages together, and the cost of your developers increases immediately. Then, the cost of coordination and maintenance will increase accordingly, which outweighs the loss. In fact, you can use a language for preliminary development, such as php, which is easy to deploy and flexible. After the project is built, if you find specific problems in actual use, if php cannot provide a good solution, you can use other languages to solve the problem. At this time, the reconstruction cost is reduced because the business logic is stable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.