I have a completed web app in PHP 5 + MySQL. I have not yet started its conversion, but it will migrate to ASP.NET MVC + MS SQL 2008. I'm not sure how to progress for the easiest transition:
Edit the PHP DAL for SQL Server. Migrate to the new db immediately
Leave the live code alone. Create ASP.NET MVC with a MySQL DAL to use for now. Migrate to new db later
Leave the live code alone. Write the new version entirely. Transition db and code at the same time
Is there some common wisdom for which path is best to take?
Edit: addressing Dave's question:
How are you accessing the database? If you have really good separation
between your code and database and are using stored procedures it would
probably affect the answers given.
None of the ASP.NET MVC stuff has been written at all. There will have to be some changes to make the current PHP data layer work with MS SQL. I'm currently taking advantage of some PHP+MySQL stuff that doesn't exist with PHP+MSSQL. Nothing major but it will take some amount of retooling. My data layer is sufficiently separate that I hope it won't be too invasive.
Also what's your release plan? Will you be forced to release incrementally
or do you plan on just "flipping the switch" one day?
Flipping the switch -- it's just a hobby site for my family. But I'm not opposed to leaving 1 db and both code sets live for a while until I feel confident that the new one is fine.
Edit 2:
Looks like my options are limited more than I thought. You can only use PHP's native MSSQL functions for SQL 2000 and before. For 2005+ you need to install MS provided drivers. I'm on el cheapo shared hosting so I can't really ask them to install drivers for me. Looks like I unfortunately have my answer :(
The purists will suggest starting with TDD so you can have a gauge of when the migration is fairly complete by having all unit tests pass.
However, I would suggest that you start with the app from scratch in ASP.NET MVC as it's very different from a non-MVC PHP application. I'd map the data layer first and build some models then work my way up controllers and the view. The data models should be fairly easy to migrate if you use the visual studio surface designer.
An easy way would be to use an Application generator.
There are many available like:
- Iron Speed Designer (only supports ASP.NET)
- Code Charge Studio (supports many different web scripting languages like PHP, ASP, ASP.NET, Pearl, etc.)
I have tried out both. But have not been satisfied with any as they have not documented the MVC/MVP part to extent that it becomes easy for developers to modify generated code.
Iron Speeds Designer MVC is better compared to CCS but ISD will prove to be costly as it supports only one set of technology while CCS supports many and one can add support for new language with a little support from its developers.
Related
I am developing a new page and can not decide witch server technology I should use. I will try to describe as best I can, what I am making and hoping someone will have some advice for me.
The choice I have to made is PHP vs ASP.NET and in case of ASP.NET MsSQL vs PostgreSQL.
I must say I already spend a few months comparing and experimenting with this 2 products (and know both for many years, but for small projects).
So if I get to the point:
My web page will definitely be SPA. I don't intend to change some div content to achieve that, but open different content in dialogs or if you know KendoUI windows.
Everything else could be adapted to the selected framework. I don't plan to have many different views, but those few will heavily depend on data from database. The core of my page will be one view bind to a table with few 10/100 thousand records.
I am using jQuery to get data from server. I started with PHP, but it soon became very large project, tons of files for handling users, roles, access to file system, managing database, quering database, editing database, handling different language support... I use try version of zend studio which is great framework (you get debugger which is a little bugging from time to time) but can not compete with visual studio.
I also read on internet that all big sites (except SO) use PHP because they started small and when they became big there is no way to migrate to different server technology.
I get problems with requires files (there are to many) if I include from index.php there is different path that from AjaxCall/ProcessLogin.php. I always forgot to include some file and get unexpected result in client. ASP.NET would solve this problem. I huge disadvantage is also unknown types in PHP. I call function which return array of objects populate from database and I don't know nothing about object structure, but when using LINQ to SQL I know everything. It bothers me also that can not have 2 functions with same name and different parameters. LINQ to SQL is also amazing. And so on. Those who use both of them, you can say what advantages has developing in Visual studio c# over Zend studio in PHP.
I know (from what I read in past months) that PHP will get me better performance, that sometimes could be slower because of the interpreter. Again, I just use functions to get some data and on client side use telerik KendoUI for rendering contents.
My questions that I can not answer myself is is ASP.NET the right choise if I don't plan to use any other feature then [WebMethod] (any server side events, ASP.NET controls...)? Probably I should go with ASP.NET Web API or ASP.NET single page application? I read tutorial how can I call method with jQuery. I also found this thread. But I need to decide if I stick with PHP and do some hard work for stuff that I mention up, or I should use ASP.NET, get some really nice stuff on account of performance.
I must say that cost are not the problem. Hosting windows server, Visual studio ...
tldr; use PHP's Laravel Framework, it's a very good framework to start and it grows with you. Also it's heavily influenced by ASP.NET and Rails, just for the PHP world. Build your REST API with laravel and use jQuery for the AJAX stuff. Querying the database (e.g. postgres) with Laravel is amazing, just write something like User::where('age', 21)->get();.
Check spa-cart.com
Already much features with PHP SPA CMS
Hi all i am a Student working on a project in an Hospital we designed an application where patient can book an appointment with doctor similar to this application (apphp.com/php-medical-appointment/examples/sample2/index.php) and our application uses php and mysql and runs on microcms framework now what we are trying to do is to get this application integrated with MedTrak (http://www.intersystems.com/trakcare/) which uses CACHE DB (Intersystems Cache db a post relational db)
we have written our application using mysql so is there any possible ways that we can fire data from our application to their db and. get, data from their db
So far we have tried these methods
odbc will it work cause we have to write our application in ODBC again
Help
Enterprise Application Patterns is a great book and I highly recommend it. However, I would add that even if you had top notch messaging middle-ware available to ensure the 2 applications are as loosely coupled as possible, at some point you will have to read or write to the Cache database, and you will probably need both.
Also, a sophisticated approach to integration may or may not be feasible on a student project. Perhaps it would be sufficient to have most of your code talk to an abstract communication layer that encapsulates the exact integration? You could start with whatever is simplest to implement but could have a story about how it could be changed later. Even this is probably quite hard enough for a student project, since the interface really should assume the communication is asynchronous.
In any case, at some point the rubber will meet the road and you will have to read and/or write to the Cache database. And at that point, ODBC is available, and sounds like it would be a good choice for you. There are other methods to connect to Cache but ODBC is widely used (and therefore probably more reliable) and doesn't require you to learn Cache Object Script, which would be a lot of extra work for your situation.
There are many ways to achieve this - the best way to learn about this is to read "Enterprise Integration Patterns".
I wouldn't recommend writing directly to each other's database - it is a fragile way of gluing apps together, because a change in one schema requires you to change the other app at the exact same time. You have to deal with exotic failure modes - one database may be down for backups, which means you can't write the changes from the other database to it.
Read the book for alternatives!
I'm in the process of building a rather big web application with PHP + Codeigniter. When I first began this project I was excited by the hosting provider PHPFog product of PHP-as-a-service. The idea of simply developing my application and not having to worry about server maintenance, setup, securing, etc appealed to me.
However, I've had far too many issues with PHPFog to be comfortable trusting it with hosting my application. I've run into situations where I've deleted a file from my git repository, pushed it to my remote repo at phpfog, and wound up with the file not actually being removed on one or all of my application servers. The service is also supposed to provide newrelic for application monitoring however this only worked briefly and hasn't worked at all since August 10th despite numerous complaints. And their customer service is far from satisfactory in helping solve all of these problems.
So now I'm considering alternatives, and Heroku has caught my attention. Heroku seems like a much more mature cloud application platform. However it does not provide PHP hosting. Instead it provides ROR, Java, Node.js, and Clojure.
How difficult would it be for someone with a lot of experience in PHP (and the Codeigniter framework) to learn Ruby + Rails and rebuild an application? Both organize code in the MVC pattern, so I hope that means my views would only require modification of their hooks to match ruby's syntax. I've already designed my database and all of the SQL queries to access the data I need from my models in CI. What do you guys think?
EDIT 1:
So I've watched this video as an introduction to ROR development:
http://www.youtube.com/watch?v=Gzj723LkRJY
And my initial reaction is 'So ROR is like a coloring book?' I'm skeptical when I see huge chunks of an application come together via something as simple 'scaffolding.' I don't know what to think other than I'm afraid that ROR sacrifices some of the granularity/control I'm used to with php
EDIT 2:
I've recently discovered https://cloudcontrol.com/ They appear to offer the same type of hosting with PHP-as-a-service that PHPFog offers but with more control, such as the ability to directly access your database and auto-scaling. Still the great idea of a git-push to deploy to multiple servers without having to deal with setting them up manually. The only thing I dislike is that their datacenters are based in Ireland (Amazon AWS). However they told me that they're planning on moving to the US in the next 3 months and offering pricing in USD.
While yes they both are MVC, yes both Ruby and PHP are scripting languages, and yes you shouldn't require much modification to your views other than changing the php hooks to ruby hooks, I think you are fooling yourself if you think it is just an easy conversion.
Ruby as a language is IMO far superior to PHP. It allows you to do so much more with so much less code. If you were to convert your PHP code to Ruby code by replacing each call with its equivalent, you wouldn't be doing it the Ruby way.
On top of that, Rails as a framework is far more mature and powerful than CodeIgniter. It will provide you far greater flexibility and convention-based help that you will code things a lot differently than if you were using CI.
Added to that, you will want to use ActiveRecord as your ORM and should write database migrations to create your database, so all those SQL scripts you have written will be pretty much useless.
If you decide that porting your app to RoR is the way to go, then I wholeheartedly encourage you to take some time and learn Ruby and Rails, and then rewrite your application as if you were doing a Rails app from scratch. You'll be amazed at how quickly you can get a project up and running.
Before this question turns into the typical Ruby vs PHP discussion, and before you embark on an (almost) impossible task, you should consider other hosting providers. There are many to choose from, some of whom offer this "PHP as a service" you're looking for.
http://vps.net/
http://mediatemple.net/
http://rackspace.com/
Please realize that porting a PHP application to ROR or Ruby is not an easy task. You may as well start again (in a language you know little about, no doubt). You shouldn't base your programming language on bad hosting experience or whatever that guy said. Use what you're comfortable with.
This one is a must read for you
http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html
I am developing a big application using PHP. Is MySQL or SQL Server the best one to use?
Neither. Use PostgreSQL. :)
Honestly though, PostgreSQL scales much better than MySQL. I don't know what you mean by "enterprise", but I figure scaling is important for a "big" web application, as you put it, and PostgreSQL does that very well. MySQL can't handle too many concurrent connections. (Though if that isn't an issue for you, go with MySQL for ease of use.)
MySQL and PHP work well together. I'd recommend that combination.
I'd much rather choose an open-source solution rather than rely on MS. That said, you can go with PostgreSQL as well if you need to, or your requirements gear you toward it. We would need more details to know what you truly require.
While this is a bit subjective, I would suggest going with MySQL.
The reason I say this is because traditionally you see people go with a LAMP setup. LAMP of course being Linux + Apache + MySQL + PHP
PHP has some great build in functionality for dealing with MySQL Databases, therefore it may be easier for you. Then you'll also have the ability to do some web based work with PhpMyAdmin tying a web interface to your Database
Use the one you and your team has most experience in terms of both development and administration.
If you start from scratch, I would go with PostgreSQL.
Between your choices I would go for SQL Server, especially if you are working in Windows environment.
It will depend on your application's needs. I'm not especially well researched on the differences between the various SQL engines, but as far as I know, MySQL is faster for SELECT queries (if you have a predominantly read-only type app). On the other hand, MSSQL and PostgreSQL both have better support for transactions, and perhaps also better performance if you have lots of inserts/updates happening. Also, MSSQL and PostgreSQL are said to scale better, but there are various successful applications that seem to do fine with MySQL (Facebook and Flickr as examples).
MySQL and SQL Server Express are free for production use. In my view the best advice is to try them both and decide for yourself. A lot of folks can live quite happily with a lightweight RDBMS where solutions like MySQL/Express may be appropriate.
From a purely technical point of view all of the major RDBMS vendors (Oracle, Sybase, DB2, SQL Server et al.) are significantly more capable than MySQL is currently or can reasonably be expected to be in the foreseeable future.
This does not mean you should not use MySQL for a particular job. A good analogy is continuing to use a version of Microsoft office released years ago. For most people the old version does everything they would ever want even though the newer version is "better" and has more features.
MySQL is certainly better to work with PHP. But MS is putting a huge effort in better supporting PHP on Windows platforms.
SQL Server is DEFINITELY the better choice for large enterprise solutions since there's better cluster and management support. We use MySQL for cost reasons, but i would really like some easier management and cluster support.
On the other hand it's like with computers: many features you need to compare if they suit your needs - and your purse.
If you are doing a one-man-show: Step away from SQL Server. It is only suitable for enterprises. Take MySQL or PostgreSQL.
For most IT directors a big decision is going to be which can you get the best support for in your area / online / already have in-house and which can you get the most uptime for. Ongoing costs are usually higher than deployment costs so its probably not worth worrying about license costs; unless you are into ia64 or better type systems anyway when the CPU count starts to make SQL look eye-wateringly expensive.
It's like deciding what computer to get, they are by now pretty much the same no matter what brand you pick. It's pretty much the same for databases, they all support most of the things that you need for lightweight webapplications.
I have used MySQL to all my php applications so far and had no problems whatsoever. I have wanted to test out PostgreSQL several times but never got to it, but I have heard very good things about it. I never touch MS products however, so no opinion (Not that I am allergic, I'm just stingy.).
We have an enterprise application written in asp.net c# (3.5) and SQL server that we want to bundle and release for customers.
However, several have expressed concerns that it requires a Microsoft server due to the costs. Yes, I know... Therefore, we are considering porting it to a LAMP stack, with the "P" referring to php.
What challenges can we expect to face developing on a LAMP stack coming from a Visual Studio asp.net environment?
The issues I am sure of are:
Debugging: Visual Studio is awesome for both client and server side debugging.
Framework: The code behind model works great, and the MVC framework is nice.
Maintenance: We would like the feature set to be common on both platforms.
Database layer: Code is loosely coupled to the mssql data types.
If you've been through this exciting process, I'd love to know what it was like with some recommendations/tips.
As a side to this, is there any way for us to run this code as is? Mono? Others?
Another PHP IDE that you can consider is NetBeans.
As a .NET, Java, and LAMP developer at one point or another, the biggest change was largely cultural. For example, PHP has a legacy of not using OO principles whereas ASP .NET started off as a .NET language with full OO support. This basic difference leads to significant issues such as PHP's long lists of reserved keywords and so forth.
Other MVC frameworks:
CodeIgniter
Kohana
Yii
(Just found out about Yii. Here's an article that compares them.)
There are probably a half-dozen more out there, as well.
I have more experience with .NET than the *AMP stacks, but based on my experience with XAMPP, I would offer the following observations
Debugging: Visual Studio is awesome for both client and server side debugging.
Eclipse PDT works great for design, development, and debugging. I've heard good things about Zend Studio but haven't worked with it.
Framework: The code behind model works great, and the MVC framework is nice.
There are frameworks to allow you to separate presentation from logic (e.g. Smarty ) and at least one MVC framework is available (e.g. CakePHP)
Maintenance: We would like the feature set to be common on both platforms.
If you exclude Windows specific functionality (Windows Integrated Security, etc) there shouldn't be much you can't do in both stacks, but if you have to reproduce controls like the gridview it will be labor intensive.
Database layer: Code is loosely coupled to the mssql data types.
I am not aware of any data types that cannot be mapped between mysql and sql server and there is good documentation for handling migrations
Mono might decrease the amount of time required to port your solution, but I am unaware of any way you could re-use all of your code "as is".
i have a Asp.net background myself and have been researching open source frameworks for the last few months. I still haven't made up my mind. I've recently been looking at Grails. Seems to have the best of both worlds - a scripted, easy to use, open source RAD MVC framework on an enterprise platform. It uses the Groovy scripting language (ruby -like) but runs on the JVM so you can use full Java framework if you like. there's tons of prewritten java components out there to tap into. This thing is pretty cool. you'd be able to port your existing app pretty quickly. You'll need a Tomcat webhost though.
if you need PHP, straight PHP performs pretty well but most of the frameworks are poor performers. If go with straight PHP there's no mvc. You'd be using the traditional page based model. But you'll feel more at home. You can roll your own DAL with PDO and use stored procedures. You'll need a templating system though. Stay away from Smarty which uses it's own templating language. It's slow and why do you need to learn a seprate templating language. i never got that. Use Savant instead: http://phpsavant.com/. it uses php for template language and is fast. You can mimick code-behind with this too by creating a template page for each site page. As far as mvc there's a new PHP framework called Yii (http://www.yiiframework.com/) that claims to have the best performance out there for php frameworks. It's well documented too. It's probably the best the php framework out there if you're coming from .Net. Feels enterprisey like Zend but without the poor performance. Most of the others are toy-ish or really slow like Symphony and Cake. Php works great with Apache. Not a lot of tuning or maintenance unlike Rails and Django.
Next you need an IDE. Go with Netbeans. Use the PHP version and install http://www.xdebug.org/. Will feel inferior to VS but it's not bad.
For a DB, MySql is the sexy pick but Postgres is superior. It has one db engine that does it all. With Mysql, some features you want are in InnoDB and some are in MyIsam. If you need foreign keys and transactions you have to use InnoDB. Use MyIsam for fulltext search and faster read performance. Postgres performance has greatly imnproved with the version 8 release (same as mysql now) and has a nice windows installer finally.