开发者

Web framework for an application utilizing existing database?

A legacy web application written using PHP and utilizing MySql database needs to be rewritten completely. However, the existing database structure must not be changed at all.

I'm looking for sugge开发者_高级运维stions on which framework would be most suitable for this task? Language candidates are Python, PHP, Ruby and Java.

According to many sources it might be challenging to utilize rails effectively with existing database. Also I have not found a way to automatically generate models out of the database.

With Django it's very easy to generate models automatically. However I'd appreciate first hand experience on its suitability to work with legacy DBs. The database in question contains all kinds of primary keys, including lots of composite keys.

Also I appreciate suggestions of other frameworks worth considering.


Use sqlalchemy. On any framework you choose. It can reflect your database as ORM.


I’m currently rebuilding a legacy PHP web application with a MySQL database my self.

The PHP code was kind of spaghetti and is now rewritten in Java as it type safe, promotes well-structured code, has excellent tooling and has superior unit testing capabilities. For database to Java mapping I use Hibernate/JPA.

The web application is incrementally delivered to production. Meaning we run both Java and large parts of the old PHP code together until the application is fully converted.

But in order to use hibernate effectively we needs the database to be logical correct (something MySQL MyIsam does not enforce). So with each production release I run an refactoring scripts for the database (also used to build the development environment and do unit testing) and update the PHP code with a new version that works with the schema changes.

As a web framework I use Stripes as it’s simple, elegant and easy to learn.


I have very good experience with Django. Every time I needed it was up to the task for interfacing with existing database.

Autogenerated models are the start, as MySQL is not the strictest with its schema. Not that it will not work only that usually some of the db restrictions are held in app itself.


My first thought would be to use Hibernate and Java, but I may be biased because that is what my experience is in. You generally map your Model classes via Hibernate after you create the database anyway, so it might not be a bad choice.

I'll let it explain itself to you: Hibernate's website


I suppose that any PHP Framework (I'm a PHP guy, so I will only talk about PHP) could be OK for you ; but you should use one that's well-supported, has a large community, ...

To make things short, I'm thinking about one off this list :

  • Symfony
  • Zend Framework
  • CakePHP
  • Kohana
  • Code Igniter


Now, if you're asking "which framework is the best", it's a question that doesn't really have an answer : it's mainly a matter of personnal preferences...

Still, here's a couple of questions+answers that could bring you some interesting informations :

  • Best PHP framework for an experienced PHP developer?
  • What PHP framework would you choose for a new application and why?
  • To use a PHP framework or not?
  • PHP Framework Decision - Analysis paralysis!
  • PHP - MVC framework?
  • Which PHP Framework is right for this project?

Also, note that choosing a Framework is an important decision -- which means you should take some time to evaluate each framework and how it'll answer your specific need.

Really : you should definitely not rush that decision.


You know, there's a whole Ruby web dev world away from Rails, e.g.:

  • Sinatra
  • Ramaze
  • Webby

With such a general question it's always a bit hard to help...


Try web2py, extremely easy to prototype any webapp, and IMO a bit easier to grasp (overall) than other similar web frameworks, HTH


There are no clear cut winners when picking a web framework. Each platform you mentioned has its benefits and drawbacks (cost of hardware, professional support, community support, etc.). Depending on your time table, project requirements, and available hardware resources you are probably going to need some different answers.Personally, I would start your investigation with a platform where you and your team are most experienced.

Like many of the other posters I can only speak to what I'm actively using now, and in my case it is Java. If Java seems to match your projects requirements, you probably want to go with one of the newer frameworks with an active community. Currently Spring Web MVC, Struts2, and Stripes seem to be fairly popular. These frameworks are mostly, if not totally, independent of the persistence layer, but all integrate well with technologies like hibernate and jpa; although you have to do most, if not all, of the wiring yourself.

If you want to take the Java road there are also pre-built application stacks that take care of most of wiring issues for you. For an example you might want to look at Matt Raible's AppFuse. He has built an extensible starter application with many permutations of popular java technologies.

If you are interested in the JVM as a platform, you may also want to look at complete stack solutions like Grails, or tools that help you build your stack quickly like Spring Roo.

Almost all of the full stack solutions I've seen allow for integration with a legacy database schema. As long as your database is well designed, you should be able to map your tables. The mention of composite keys kind of scares me, but depending on your persistence technology this may or may not be an issue. Hibernate in Java/.NET supports mapping to composite keys, as does GORM in grails (built on hibernate). In almost all cases these mappings are discouraged, but people who build persistence frameworks know you can't always scorch earth and completely recreate your model.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜