views:

239

answers:

6

Hi

A project that I maintain and develop in asp.net so far has over 500 c# files (including code behind), 150 aspx, dozens of web controls, masterpages, split over various projects; web, business, cms. There are other projects that are accessed as web services (FYI developed mostly in Java by other teams).

This current project is hosted in-house and access by many clients.

I am considering writing a version of this in PHP/MySQL targeting the LAMP stack, aiming at quality business shared hosting. It will not be as big as the .net project in terms of features (mainly in the house services will be dropped) but I envisage around 40-50% of the functionality and will take around 1 man year to develop to current [on the back of a fag packet] spec, would aim for an initial lighter version release in 6 months.

It is a side project, it is not business critical, which means I am not tied to corporate policy, so I have a free reign on the whole project.

What I would like to know is what tools, what processes are going to be useful to developing. I would like to embrace unit testing, frequent integration and other agile practices (I would say we are iterative but not fully agile with the .net project). I am aware of Eclipse/Netbeans and Zend Studio as tools and phpundercontrol. Is it worth picking a framework ? What about OOP in PHP does that help or hinder large projects ?

Cheers, Webby.

A: 

I've never personally used it, but I'm told under good authority that Symfony is to PHP as jQuery is to Javascript... (very very good)

Gausie
A: 

Hard to choose without knowing your preferences, but you could opt for Python and (as a framework) Django, which should cover your requirements. For a lighter-touch framework and a mature language with loads of resources, Perl and Titanium.

I guess the main points are:

  1. in what language would you like to program?

  2. is your expertise good enough to work around the constraints of any framework you choose?

Dave Everitt
-1 because he asked for suggestions in the PHP World, not Python nor Perl
Gordon
Hi Dave.1. I am considering PHP due to having a bit of experience with it. I am open minded. Needs to be easy for a client to host themselves though.2. Hmm, good question, I'm quiet a mature developer (over a decade and a CS degree), i've worked without frameworks (asp days) and comfortable extending in an OOP way.Lukman, I said considering and to be honest PHP is my favourite option due to having some experience.
Webicus
Well, considering you're 'targeting the LAMP stack' I thought I'd suggest some alternatives to the 'P' bit! PHP can sometimes be a 'default' choice (I have to use it for some projects) but it isn't the only 'P' in LAMP and some experienced programmers prefer to add other 'P's to their portfolio :-)
Dave Everitt
A: 

I would suggest that you use python or ruby (depending on which you like better) instead of recreating it in php. They both have some good frameworks and they will make coding easier(once you learn one of them).

I personally love python and have many times could have done something easily python, but in PHP took more work.

Edit: One tip, no matter what the language, have the code that works with the database in classes. For example, have a user class that does all of the updating/inserting of the user table. To make any changes to the user table, only use the user class. Not having sql queries scattered all over makes things much easier when you need to change some of them.

Echo
Python is honestly the shit when it comes to things like this. I used to make fun of it, then I tried Django one day and was an instant convert.
Sneakyness
-1 because he asked for suggestions in the PHP World, not Python nor Ruby
Gordon
How easy would it be for a client to host and deploy and what tools would be suitable ?
Webicus
+9  A: 

I use PHP for a business critical environment where downtime means loss of revenue in large numbers. Being as you asked about PHP, I will stick with that and avoid other languages and frameworks.

Here are the tools I would recommend:

1) A good php mvc framework. We use Zend Framework, and to the first poster's recommendation, I would simply point out that a vendor attempted a rollout of Symfony for a portion of our application, and we spent several weeks dealing with critical load and outages based upon that code, as well as significant refactorin and tweaking of their code in order to make it perform under load. This has left a bad taste in my mouth regarding Symfony. The upside, of course, to Zend Framework is that it allows you to pick and choose the components you wish to use, as opposed to the 'rails' type approach often used where youstart with everything, and have to pare it back.

2) If you have DBA's/DB Developers, then this recommendation is useless, but for a single dev effort, I would recommend using a good PHP ORM. The one I am most familiar with is Doctrine, and I feel it is a great addition to a PHP app that doesnt have dedicate database developers, and as of now, plays nicely with Zend Framwork in the 2.0 branch.

3) A templating engine: This is for the benefit of future maintenance and for the sanity of any designers you might work with. A smarty-syntaxed templating engine is pretty simple to use, and I like to integrate Dwoo, thanks to its OO nature, and its ready integration into Zend Framework. (Note: I am a contributor to Dwoo, which may be considered a bias toward this tool. There are other templating engines that can be used, including Twig or Smarty.)

4)a PHP IDE: We used eclipse with PDT, and now use Zend Studio. If you can get your employer to cough up the scratch, I would highly recommend it as the integration with PHP unit, Zend Framework, and the refactorin features, not to mention the integration for debugging with Zend Server are AWESOME.

5) PHPUnit and Test Driven Development. There is alot to say on this topic, but I will leave it at 'Me Likes".

6) PHP_Codesniffer: Coding standards have many benefits, and later on, you might thank yourself for picking one. Like checkstyle for Java, this tool is a definite plus for enforcing one in your project! I like the Zend coding standard, and it comes installed by default.

7)phpUnderControl: Combined with unit testing and code sniffing, continuous integration will give you a great feeling as you know the state of your project with every build, and the project mess detection tools will help you avoid pitfalls early on, when your changes are still managable, as opposed to later, when you have hundreds of thousands of lines of code.

YMMV, Jc

JC
+3  A: 

There is no reason, why you should not use OOP in PHP. If you are used to code with design patterns, you won't get around OOP anyway. Using them is as much good practise in PHP as in any other OO language. Granted, not all patterns make sense in PHP's shared-nothing architecture, but that should not be a reason not to use them.

If you want to go TDD, then PHPUnit is a good choice. For Continuous Integration, you can use phpundercontrol or arbitracker. All QA tools these CI servers use, are freely available in PEAR. You might also want to look into phing to automate deployment.

You don't have to use a framework, but doing so will likely ease development, as you don't have to reinvent the wheel. If you are not looking for a fullstack framework, go with Zend Framework or ezComponents, as they allow you to pick only what you want. ZF is also known to play nicely with other component libraries.

Depending on how complex your database queries are, you can look into an ORM, like Doctrine, to abstract your database layer. Again, Zend Framework offers ready-to-use classes for the most common DB Architectural Patterns (and other patterns).

If you are not fixed on a LAMP, you might want to look into Zend Server CE. It offers a nice PHP stack with lots of added functionality, like op-code caching, debugging and monitoring.

It is completely up to you if you use Zend Studio, Eclipse with PDT, Netbeans or anything else for your IDE. It depends on what features you are looking for. You might want to check the answers to this related question.

What else is there? Well, probably a lot - you will want to use a VCS of some sort. Use a bugtracker, etc. PHP is just one part in your development ecosystem. Just don't forget the most important tools is your brain and your experience.

Gordon
A: 

Sorry for ignoring your other questions, but I'd really like to stress this point:

Don't use a packaged framework like Symfony or CakePHP. For a project like this, I'd recommend rolling your own. I know it's a lot of work, but most frameworks have so much bloat. Their 1.482E8 features are great for getting shiny apps off the ground quickly but can kill an app with high traffic.

If you design your own, it will grow with your project and be tailored to your needs. It won't have any unnecessary bloat. MVC is just not that hard to implement.

Lucas Oman
There are pre-existing excellent light-weight frameworks. And even big frameworks aren't necessarily monolithic.
rick