November 6th, 2006, 04:44 PM
Should I learn PHP or Ruby?
I've got minimal programming experience, took C back in freshmen year of college when I was pursuing a computer science degree, but dropped out to do finance instead. I still kept on with my web design and affiliate marketing throughout my college career.
Also learned ASP a while back as well.
now that I've graduated, I'm thinking of picking up a programming language again to work on bigger projects that requires more than using pre-built scripts.
What would you guys suggest I start with, PHP or Ruby? My friend is saying Ruby will eventually overtake PHP.
What do you guys suggest? Book recommendations?
November 6th, 2006, 04:48 PM
I would say go with PHP, simple, and yet, powerful. Dont get me wrong ruby is a very good language, but they all do jobs, and I dont think ruby will take over php. Seeing alot of people who love and use php, wouldnt feel right switching straight over to a new language. But that was offtopic. I say php. But that is me. As for books, w3schools and php.net have loads of information. Hope I could help!
November 6th, 2006, 04:49 PM
i forgot to mention that I'm looking to develop a couple unique sites that has potential to get huge amount of traffic , which language will be the fastest when it comes to lots of traffic? (think digg traffic)
November 6th, 2006, 04:56 PM
Its not what language, its how you use it. For web dev I say go with PHP, cause ruby on rails is very rarly found. But php isnt the only scripting language out there. ASP,Perl,etc. But I say go with php. But its up to you. Google for some examples and see which one you feel more comfortable with.
November 6th, 2006, 04:57 PM
I would say definitely PHP. If you have time learn both however, because I don't think you can know too many programming languages. One thing that Ruby is known for (primarily because of Rails) is that it enforces certain conventions, especially when it comes to accessing databases. PHP on the other hand leaves it up to you for the most part unless you use a similar framework. There are many more frameworks and ways to do things in PHP.
If I had time though I would love to dig into Ruby/Rails more than I have. I would never stop coding in PHP however.
November 6th, 2006, 04:59 PM
i don't know for a fact but php i beleive has a smaller overhead.
PHP is more designed for web based application, it has some OOPish features to it. but it was designed as a web based language for web based stuff.
Ruby is more like C/C++ it HAS OOP stuff more of an application than a web based such thing.
if you do a little research on both youll get the better grasp of their strengths in weaknesses. im sure if you plan to develope dynamic website you will use a combination of both (if you plan to use ruby)
November 6th, 2006, 05:24 PM
Just my $0.02.
First of all, asking "PHP or X" on the PHP board is most likely going to get you the answer "PHP!"
Secondly, if you want to write something that gets the traffic of the top 10 sites, look at what they write in. Slashdot uses Perl, but that's because they are all gurus and out of their mind. Penny-Arcade uses ruby, but they have a very tight layout and only 2 pages, really.
Digg seems to use PHP, but I can't confirm that.
If you're worried about processor time and lag visible to the user, there's two solutions:
1) Write in a lower-level language. You could write your whole thing in C modules that plug directly into Apache. That's a terrible idea. Or you could write in Perl, which is slightly lower than PHP. DON'T write in ASP or Java.
2) Buy a better server. Personally, I like this one, because it allows you to cheat also. If you have a server with 16 processors, you're less likely to spend inordinate amounts of time making things "perfect" for version 1.0. Better servers help you get your stuff produced faster, and faster production times get you better servers quicker. It's a self-fulfilling cycle, so kick-start it with good stuff.
All that being said, I still am going to answer "PHP!" I've used ASP, C#, Perl, PHP, JSP, and even worked on a webserver written in the aforementioned C modules. PHP is the best for rapid development while still retaining total control over the code, and falls right in the middle of the pack in terms of processor cycles used.
Ok, that was more like $0.25.
November 6th, 2006, 05:42 PM
November 6th, 2006, 05:44 PM
Look like I know what language too learn then!
thanks for the quick responds!
Do you guys know some books I should buy?
November 6th, 2006, 05:46 PM
Dont waste your money. Learn online!
Check em out!
November 6th, 2006, 05:49 PM
FYI Digg's written in PHP.
It really depends on what you want. The main selling point of Ruby for web dev. is the framework Rails which makes development very rapid. However, look around for decent php frameworks (symfony, cake) and you have that as well.
For what it's worth, Ruby is known to be much slower and resource hungry than any of the other languages (although they're working on it a lot to speed it up & I hear that running it via mongrel speeds it up quite a lot).
Another thing to keep in mind is that most cheap hosting plans will have PHP running, but not mod_ruby, you may be able to get it running via fastcgi or something, but again, that's not common.
& if you've expecting digg-level traffic, then get a pro to design your app to scale properly.
November 6th, 2006, 05:50 PM
Books aren't necessarily bad, but I would take heed of the articles on the web and the posts here about pitfalls (register_globals, SQL injection, mail injection, addslashes, etc.). That seems to be where some books on the subject fall down.
November 6th, 2006, 06:02 PM
The web is always the most up-to-date resource, I've found that just linking the PHP site to my searchbar in firefox speeds me up quite rapidly. Once you get the basics down you can use forums and the PHP documentation to finish anything else you need.
If you're going to buy a book, I would recommend one of the catch-all books from publishers like O'Reilly. Don't try to get "Writing large scale PHP applications that run on IIS and use MySQL and are more than 30,000 lines and all variable names start with $fred_". Some books over specialize. Use a book to get the general feel of the language, and use the web for the specifics. Books don't have search features, after all.
A good dev framework for PHP (which I've used to smashing success) is PRADO
It works like .NET in practice, and everything is object-oriented. It's beautiful, and your code doesn't mix, so even if you hire a professional designer he'll never be able to screw up your PHP.
November 6th, 2006, 06:08 PM
another thing ill throw in is php is much more popular than ruby, so if you need help youll have less trouble getting it
November 6th, 2006, 06:18 PM
I would say learn both. Ruby is thinking language, where not only logic is needed, but also you need to create the real underlining code to do exactly like you want. Much like Perl, very few core based functions, but a powerful compiler so you can use your own creativity to power your application. PHP is not like that, it's function based language, with thousands of functions, that have been tested, rebuilt and tested again to give you a simple method to do something without the need to create a script based process to do what you want.
In that sense PHP is very powerful, but that comes with a price, and that price draws in many people that don't want to learn anything, they only want to achieve something, which results in millions of trash based programs written in PHP.
Ruby on the other hand, takes time to understand, because it's scripting based structure is not anything like C, for people to say that it's like C, don't really know anything about it. PHP structure is much closer to C, than Ruby. But with Ruby everything is OO, in that everything is object based. It has some great points, because it uses many development languages in it's core, like Perl, Smalltalk and Ada. Once you do learn how Ruby does things, you will find it's just as powerful as any development language where real thinking is needed, which in PHP, is not always the case.
Comments on this post