Author Topic: Back to PHP  (Read 2062 times)

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Back to PHP
« on: December 08, 2009, 01:19:55 AM »
I'm working on a couple games to play with some friends on my iPhone and other fancy smart phones. The idea is to create some simple web based games that we can play when we're supposed to be working and be able to play against each other. I'm starting simple with games like connect4 and such and will work my way up to more interesting games, like Hive or tanks maybe.

Anyways, since I'm cheap and only pay for a typical low budget web host to run my website(s) I think I'm going to end up doing the project(s) in PHP. It's been a while and at work I'm primarily Grails but Grails, while fast to develop in, is still quite heavy due to the JVM it requires. And many of our applications at work are quite small and while I could do them other ways, they usually require a resource hog (Tomcat). So I'm somewhat evaluating if we might be able to move some of our simpler development over to PHP.

After looking over some of the PHP frameworks to work in a similar fashion that I'm used to with Grails, I think I'm going to give CodeIgniter a try. It seems very light weight and a good fit for easy setup and quick and dirty coding, while still having some of the benefits of the application designs I'm used to.

I'm not sure if this is a wise move or not though since I'm not sure how valuable PHP is going to be in my skill set (vs say, Ruby and RoR). I've always had an appreciation for the minimal footprint of PHP, but never really got a chance to really get to know it. I think it might be some time before all the PHP folk and shared hosts make the switch to RoR but I definitely see it happening.

I might also go back to RoR but after learning Grails I didn't really like it as much (and had no real reason to pick it up further). The Groovy syntax was a very natural transition, although I continue to be frustrated from time to time with the development of Grails; it moves very quickly and has a tendency to break stuff you did no more than a few months ago. Once it stables out a bit more that will go away I believe. And the lack of mature plugins can be problematic sometimes. When you're trying to move quickly and you find out you actually have to build a plugin that doesn't exist or won't work for you, it just slows you down.

So, I might be asking some PHP questions in the near future on a few things until I get myself back up to speed again. It's been a few years since I've done anything more than modify my blog templates and such.

I'll let you guys know what I think of the framework after I get a little bit more familiar with it. But it looks pretty good so far.
This signature intentionally left blank.

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14305
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: Back to PHP
« Reply #1 on: December 08, 2009, 08:07:40 AM »
Very cool.  If you need faster feedback, you can always try www.phpfreaks.com/forums.  I'm an admin over there but I don't think I've actually hit the site in a few weeks (life is too damn busy lately).

webwhy

  • Jackass IV
  • Posts: 608
  • Karma: +15/-10
Re: Back to PHP
« Reply #2 on: December 08, 2009, 01:53:04 PM »
We chose codeigniter for our PHP project as well for the same reasons.  Symfony was second since it seemed to provide a true ORM layer, but that added a lot of complexity.  Since it was simpler, everyone was somewhat productive using codeigniter within a few minutes, the documentation is very good as well...

That being said, there are plenty of inexpensive options for hosting applications written in other languages/frameworks.  Slicehost, Webbynode, even Google App Engine (which is basically free up to ~5M page views).  I personally would consider all of them before settling on PHP.  That's just my opinion...

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Re: Back to PHP
« Reply #3 on: December 08, 2009, 02:52:38 PM »
My JVM skills don't lend well to shared hosting. The best thing I've seen would be get a small cloud server from Rackspace but since Java is a memory hog, I wouldn't be able to run too many applications or separate them like I prefer.

I recently tried to get a Grails app running on App Engine but that proved too difficult for the moment. It seems too new and there's very little help available.

I don't really like Python, but I admit I never really gave it a fair shake. The required indentation put me off from the very beginning. I really do sort of like {} for a great many reasons. Although since Google seems to be all about Python, it's probably not a bad thing to suck it up and give it a chance. The basically free App Engine makes that rather enticing (which is why my excitement got up when they started "supporting" Java). I might give it another try with Django but we'll see. PHP is just much more familiar.

Ruby is an option as many shared hosts (including mine) now typically have that option, but now that PHP has got itself up to speed with the "current" frameworks I'm really sort of at a loss of why Ruby would be better to go with. Since I'm at least previously familiar with PHP from my earlier coding years, if I can bring my current practices and designs over to the language and it offers me everything the other guys can do, I don't see it as a bad idea. Probably the best idea.
This signature intentionally left blank.

webwhy

  • Jackass IV
  • Posts: 608
  • Karma: +15/-10
Re: Back to PHP
« Reply #4 on: December 08, 2009, 04:10:54 PM »
Quote
but now that PHP has got itself up to speed with the "current" frameworks I'm really sort of at a loss of why Ruby would be better to go with

I can think of multiple reasons; all of which have to do with the language regardless of what framework is being used.  Nevertheless, you're right.  if getting things done is the primary goal, learning something new loses every time...

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Re: Back to PHP
« Reply #5 on: December 08, 2009, 05:05:00 PM »
What's "better" about some of the languages vs PHP? What sort of things can you do in say Python or Ruby that you can't do in PHP? Or is it simply the way the other languages do their thing?
This signature intentionally left blank.

webwhy

  • Jackass IV
  • Posts: 608
  • Karma: +15/-10
Re: Back to PHP
« Reply #6 on: December 08, 2009, 05:52:13 PM »
Quote
What's "better" about some of the languages vs PHP?
I don't have much experience with python, so I can't speak for it.  I am experienced with Ruby so i can give a few quick bullet points.  I think these things make the language better for various reasons.  All of which are my personal opinion...

  • Ruby is truly object oriented.  PHP is not
  • Ruby supports relatively safe and useful multiple inheritance via mixins.  PHP only supports interfaces.  you can't reuse implementation across inheritance trees
  • I prefer strongly but dynamically typed to loosely typed.  i hate PHP's type coercion
  • Ruby Stdlib is more consistent in it's method signatures.  PHP's functions signatures are inconsistent
  • Ruby collections win over PHP arrays mainly because of items 1 & 3
  • Anonymous High Order functions are easy in Ruby.  At best, they're awkward in PHP
  • Ruby is elegant and concise.  PHP is not
  • PHP runtime configurations can vary widely.  Ruby is way more consistent on what is supported in the environment. i can feel safe that any method will be supported on all interpreters of the same version and implementation.  not so in PHP 
  • interactive interpreter is invaluable for hashing out quick ideas.  I'm not aware of php having this so it loses
  • Namespace support in PHP is relatively new; to preserve backward compatibility or no one understands the benefits, they're not used.  Ruby modules are an easy way to prevent naming collisions

Ruby makes it possible to write apis that look like the following (these are actually part of Rails):
Code: [Select]
# Timestamp from 3 weeks ago.  Comment not necessary
3.weeks.ago

# split collection in groups of two
[2,4,6,8,10].in_groups_of(2)

# you could easily change the above to something even more readable
[2,4,6,8,10].in_groups_of_2

This is the main reason.  Clean interfaces and DSL creation are easy with Ruby.  My wife can read the above example.  Good PHP API's don't read as well
« Last Edit: December 08, 2009, 08:25:05 PM by webwhy »

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: Back to PHP
« Reply #7 on: December 09, 2009, 06:25:15 AM »
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."