How to port an obsolete Java / J2EE website to a modern scripting language (PHP, Python / Django, etc.)?

I want to move the legacy Java Java Application (J2EE) to a scripting language β€” any scripting language β€” to make programming more efficient.

What is the easiest way to do this? Are there any automated tools that can transform the bulk of business logic?

+4
java python java-ee php django
source share
4 answers

Here is what you need to do.

First, make sure you can walk before starting. Create something simple, perhaps regarding your main project.

DO NOT create part of the final project and hope that it will "go" into the final project. This does not work well. What for? You will make dumb mistakes. But you cannot delete or recycle them, because you have to change this error in the final project.

Then select the frame. What kind? Secondly? Yes. Secondly. As long as you are not actually doing anything with some scripting languages ​​and frameworks, you do not have a real useful concept of what you are doing. Once you have created something, you now have an informed opinion.

β€œWait,” you say. "To do step 1, I had to choose a structure." True. Step 1, however, contains solutions that you can reverse. Choosing the wrong structure for step 1 does not have long-term negative consequences. It was just training.

Thirdly, with your strategic base and some experience, break your existing site into parts that you can create using your new structure. The priority of these parts is from the most important to the least important.

DO NOT plan a complete conversion as one massive project. He never works. This makes a lot of work more difficult than necessary.

We will use Django as an example. You will have templates, browsing features, model definitions, URL mappings, and more.

For each assembly, complete the following steps:

  • Convert an existing model to a Django model. This will never match your legacy SQL. You will have to rethink your model, fix old mistakes, fix old mistakes that you always wanted to fix.

  • Write unit tests.

  • Create a conversion utility to export old data and import into a new model.

  • Create Django admin pages to touch and feel the new data.

  • Select representative pages and recycle them into appropriate templates. You can use some old JSP pages. However, do not spend too much time on this. Use HTML to create Django templates.

  • Plan your URL and see the features. Sometimes these view functions will use the old action classes. Do not "convert." Rewrite from scratch. Use your new language and structure.

The only things worth saving are the data and the operational concept. Do not attempt to save or convert code. This is misleading. You can convert unittests from JUnit to Python unittest.


I gave this advice a few months ago. During processing, I had to do some coaching and review. The revised site is up and running. Lack of transition from old technology; they suggested rewriting from scratch. The developer is happy. The site is working well.

+11
source share

If you already have a lot of business logic implemented in Java, I see two possibilities for you.

The first is the use of a high-level language that runs in the JVM and has a web framework like Groovy / Grails or JRuby and Rails . This allows you to directly use all the business logic implemented in Java, without having to redesign the entire site. You must be able to take advantage of the improved performance with respect to web development and still use your existing business logic.

An alternative approach is to turn your business logic layer into a set of services available using standard mechanisim RPC - REST, SOAP, XML-RPC or other simple XML protocols (YAML or JSON) over HTTP (see also DWR ), so that the interface can call these RPC calls for your business logic.

The first approach, using a high-level language for the JVM, is probably less restructured than the second.

If your goal is to completely migrate Java, then any of these approaches will allow you to do this in small steps - you may find that this kind of hybrid is better than the whole sale - the JVM has many libraries and integrates well into many other systems.

+7
source share

Using an automated tool to β€œport” a web application almost certainly ensures that future programming efficiency is minimized - not improved.

A good scripting language can help improve programming efficiency when used by good programmers who understand good coding techniques in that language. Automated tools are usually not designed to output code that is elegant or well-written, only code that works.

You will receive only an improvement in programming efficiency after you make an effort to re-implement the web application, which, due to the time required for re-implementation, may or may not lead to an improvement in general.

+6
source share

Many of the recommendations here suggest that you - and only you - completely rewrite the application. This is probably not the case, and it changes the answer a bit.

If you already have J2EE, the correct answer is Grails. It's simple: you probably already have Hibernate and Spring, but you want to be able to flip back and forth between your old code and your new one with minimal pain. This is for sure Groovy forte, and in this respect it is even smoother than JRuby.

Also, if you already have a J2EE application, you already have Java developers. In this case, Groovy training is like falling down a ladder - literally. With the exception of anonymous inner classes, Groovy is a pure superset of Java, which means you can write Java code, call it Groovy, and do with it. As you become more and more comfortable with the virtues of Groovy, you can integrate them into your Java-ish Groovy code. For too long, you will write Groovy code and have not even implemented the transition.

+1
source share

All Articles