In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Why PHP+Java development is not too object-oriented, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.
When it comes to object-oriented, many languages now have some. Java is a traditional object-oriented language, PHP also has some object-oriented, but not very good. Completely object-oriented in a specific project (this article is a Web development project), sometimes it is not the choice of *. The author finally chose a model of PHP+Java and shared some of his own experiences.
I came into contact with C++ (high school) and accepted the idea of object-oriented earlier. Object-oriented thinking is closer to the human way of thinking, its encapsulation, inheritance and other features can often simplify some work, the most important thing is that the train of thought looks much clearer. I believed in the idea of object-oriented until one day I got confused in the WEB project.
My previous work is also related to WEB development, usually the project is the interface, implementation, service layer, DAO layer like this. Over time, I got used to this model. Later, I started to make my own website (run by myself), and I followed this model. It took me a while to get things out, so I could run away, and the problem came with it. As we all know, things like portals, especially growing websites, may often face some changes and expansion. Unlike a corporate project or a website that operates in a stable mode, it can be used all the time with a set of written programs. But JAVA things are a little troublesome to change.
*: a lot of APIs are used in the project, and the APIs are often changed when the business changes. Some people may say that this is because the demand is not done well. Yes, you can think so, but there is a premise: the demand can not be put in place in one step, otherwise the website will not run, and when the demand analysis is done, the flowers will be gone. Recall this classic process: to add a feature (not discussed in the page section for the time being), first add or modify a service interface; then add or modify its implementation; and then add or modify a DAO layer interface corresponding to its implementation; * *, what we really want to change is often just a SQL statement.
This series of procedures are too cumbersome. The portal website basically displays information, and its business logic, in the final analysis, is basically reflected by SQL statements. If you think about it, what is displayed on the site, how to sort it, and how to aggregate it, don't they all correspond to the corresponding SQL statements? What's the point if you have to write the DAO layer as a basic addition, deletion and modification, and then write a big article in the service layer to implement a business catalogue that corresponds to a SQL statement? Layering for the sake of layering? Object-oriented for object-oriented? Not to mention the pile of interfaces, which increases the workload for nothing. Of course, I will not deny the significance of interfaces in programming ideas, but is the pile of interfaces in traditional JAVA WEB programming really a reasonable application? I don't think so in many cases. I later used PHP to rewrite a large part of the functionality of my project, which took only a few days, with no layering and no interfaces. The improvement of work efficiency brought about by this is really pleasant!
Second: the release of JAVA WEB projects usually needs to restart the service, resulting in the interruption of WEB operation. Many people are talking about hot deployment. I don't know what level the heat will eventually reach, but I don't think it will be possible to modify the file at any time as PHP does. In order to keep the service uninterrupted, I usually choose to do a cluster and release it in turn. Although this may still cause some problems, it is much better than interrupting the application. But the cluster will bring trouble in publishing, and the cluster itself may not be what I really need.
There are also some minor problems, such as if my project contains some folders that store a large number of files, and I have to deal with them specially when I release them, which is very uncomfortable. Even if you do soft links, you will inevitably have to do extra work when publishing. Of course, I think there will be a better solution to these problems, which I am still exploring.
In the face of these problems, I finally stopped sticking to object-oriented. I changed the project into a pre-PHP and post-JAVA form. PHP front-end appears to be much more flexible, the entire revision, the logical part of PHP does not spend much time, time is spent on the page design; the back-end of JAVA can ensure stability and efficiency, easy security design. As a result, I finally sent out the exclamation of "Don't look like the object too much". Demand determines everything, and following other people's thoughts is no different from joining a cult.
The problem is not over. For the JAVA back-end, I am still exploring a plug-in-based CMS back-end system that can be hot loaded and cut off plug-ins. Oh, you can't beat the face object to death with a stick for the above reasons.
Anyway, after reading the author's description, you might as well try the PHP+Java combination: see what benefits you can get from giving up some object-oriented.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.