August 13th, 2012, 06:12 PM
Rails vs PHP (w/ framework)
I'm currently starting a new website and I have an important decision to make: **Rails or PHP (w/ a framework)**. I know that this question is not only subjective but has also been asked before (and in fact has many elaborated articles about). There are few reasons I want to ask this (again) tho:
- My question is based on *personal circumstances*, hence there is a good chance answers will vary in this case (in fact I haven't had much luck finding answers to fit my situation).
- Most answers I have found are outdated. Web-development is a dynamically changing field, there is a good chance that resources I found are no longer valid.
To make this easier (and less subjective) I split my question into several little ones that would hopefully be objective.
- I have many years of experience with PHP. This would help as I already know many little techniques,workarounds etc. that I can use and I am more comfortable with coding in PHP.
- Previously to a month ago I have had no experience with MVC.
- I have about 2 months of experience with Ruby (and one with Rails; mostly playing around to see how things work - nothing serious).
- The only 'proper' framework for PHP I know is Yii and even with that, my knowledge is very limited (about a month although I feel pretty good with Yii).
- The website I am developing will have some dynamic content (news systems, articles etc.), user authentication, payments online, event entries etc. It's certainly bigger than your average personal page, however it's not as big as stackoverflow or facebook.
- Which framework has the biggest future? I am looking to develop this website using language(/framework) that will give me the most (and the most valuable) experience.
- Which framework/language is the quickest to code in? I know that this will be heavily dependant on experience I have with the language, however we all know that some languages/frameworks are just quicker to use.
- Is scalability/performance going to affect me much, given my project?
Thoughts so far
In favour of rails:
- Being new to MVC, I particularly enjoy the idea of being 'forced' to use correct approach (The Rails Way)
- I enjoy coding in Rails. Rails was developed to be fun to code in, right? Well I think it is
- A lot of tools that I like using (eg. SASS, HAML) seem to have originated from Rails (or been originally created for it).
- Rails provides a lot of features - but not too much. For example, implementing own User management or client-side validation is one of the things I had to do in Rails which I didn't in Yii. I consider this a positive thing as it makes me 'aware' of exactly what is going on (I dislike writing code that generates something I have no idea of how it works). Obviously this could be done with Yii and other frameworks as well but it just doesn't... well feel the same.
- While being 'forced' to code in the 'right' way is (for me) a positive, it's also a negative. There are things that Rails doesn't support out of a box and are very hard to 'enforce' (for example checking if a link in URL form refers to current controller/action).
- I've read that deployment for Rails is a nightmare.
- I see people returning to PHP after working with Rails for several years.
In favour of PHP/Yii:
- Performance. Nuff' said.
- Flexibility. A lot of things in Yii can be done using 100 of ways (whether they are 'correct' or not).
- SQL. A very little thing but I enjoy working with SQL queries - something I don't (directly) get to do using Rails.
- Community: PHP has been around for longer, there are more resources and people who know what they're doing.
- Yii provides a lot of things out of the box as well - for example client-side validation.
Against of PHP/YII:
- Some of the things Yii does, that are useful (for example client-side validation), I have no idea about. I know how to **use** it but I don't know how it **works** - and frankly unless I have to write it I probably won't spend time trying to figure out exactly how it works.
- Flexibility (again both positive and negative). Bearing in mind I'm new to MVC concept, it is good to have something 'force' me to write correctly.
- Yii is not really MVC - it's more like MVP which only complicates things.
I know I have asked for things to might lead to off-topic answers and that are subjective but I really hope that somebody would explain to me how Rails and Yii/PHP compare in terms of the 3 questions I have asked. Lastly, two things to bear in mind:
- I want to write this project to get a functional product but also **to learn skills valuable in future** - I want a choice that is somehow 'future-beneficial/future-oriented'.
- If there other frameworks for PHP I should check out - I'm open for suggestions.
Thanks for any help and I hope this isn't too of-topic/general
August 14th, 2012, 01:06 AM
Nobody really knows, but given the current dominance of PHP, even if it were to start dying out today it would take many years at least before the demand for experienced PHP programmers went away.
Given that you already know PHP, PHP will be the fastest to use by a huge margin. Differences in experience affect programming speed so much more than the language or framework syntax that it's not really worth comparing the syntax directly in most cases (not to mention that there really is no objective measurement for comparison).
Scalability is not a major attribute of specific languages, it all depends on how you structure, design and write your code. Performance is somewhat an attribute of the language, but Ruby and PHP are probably pretty similar overall.
I'm a PHP programmer, I don't know Ruby at all. I've met two people in the past who had done intro projects with Rails, and neither were particularly happy with the end result that they got. I'm also not a fan of PHP frameworks that try to emulate the way Rails works. Therefore I recommend PHP.
August 14th, 2012, 05:02 PM
Thanks, I really appreciate your answer This gives me a fair idea, I'll probably stick to PHP