Posts tagged with 'php'

THE PROJECT: Language? Framework?

One of the first things I need to determine about THE PROJECT is what I'll build the application with. I'm positive I'll take advantage of one of the frameworks (like Ruby on Rails or CakePHP) to build the application, but I need to nail down which language I'll use. There are many many choices out there on what language to use, but for me there are only two I'll choose from: PHP or Ruby. But, which one? I've done quite a bit of work with both, although less with PHP. Let’s see the options:

Ruby

For the last three years, most of the work I've done has been with Ruby, either with Rails or, more recently, Merb. I grow more comfortable with Ruby every day and I still have fun learning new tricks. This had been pretty much restricted to Rails up until I gave Merb a try a few months ago. I rewrote this weblog with Merb and I had a good time teaching myself something new. Yes, there are many, many similarities between Rails and Merb, but I think there are some things that Merb does better (and easier). Rails, on the other hand, is a little more robust and has a larger community behind it. It could be easier to do what I want to (in the scope of this project) with Rails, as opposed to Merb.

PHP

In the last year, I've built a few web apps using the CakePHP framework, and I found it quite a nice change of pace to work with. Since I had a strong Rails background, CakePHP was easy to pick up since they certainly had Rails in mind when putting the framework together. However, if I went with PHP, I'm not sure I'd go with CakePHP. I've heard many good things about another framework, CodeIgniter, and I'm eager to try it. There’s nothing that particular bugged me about CakePHP, but CodeIgniter has a reputation as being a little faster, but it may not have a community as big as CakePHP’s backing it up, or as many places to look for code examples.

The Decision

So, what will it be? First of all, I think I can narrow it down to using Ruby instead of PHP. PHP is more widely supported (and easier to deploy, etc., etc.), but I think my day-to-day experience leans me more towards Ruby. I'm just more comfortable with Ruby than I am with PHP. I do want to use the CodeIgniter framework for something in the future (and I think I may already know what that is), but I just don’t think it’s quite right for this project.

That leaves me with the Ruby language, but which of the frameworks? Merb is just about to reach the big 1.0 milestone, but while Merb may be ready, I'm not sure I'm ready to build something big on the framework. It’s still young and with many fairly drastic changes in the API the last few months, there’s not a whole lot out there in the way of documentation and sample apps and code. In the few years I've been working with Ruby on Rails, the community has exploded with plugins for just about everything, tons of sample code, and a growing reference library (thanks to the Rails-related weblogs and numerous tutorials). I know Rails is up to the task, and that it can handle all that I'm wanting to do (and more).

In my mind, that settles it: I'll use Ruby on Rails.

Oct 31, 2008 11:58PM (merb, php, planning, rails, ruby, theproject) Add Comment

Oh, how I hate ASP

Writing ASP (Active Server Pages) sucks. All I want to do, is to add one array to another. Sounds easy, right? Well, with ASP it isn’t. Not by a long shot.

But first, and just for contrast, let’s see how PHP does it:

$array1 = array("12","35","45");
$array2 = array("334","355","456");
$new_array = array_merge($array1, $array2);

Nice and simple, right? Okay, now how about Perl?

my @array1 = ("12","35","45");
my @array2 = ("334","355","456");
my @new_array = (@array1, @array2);

Wow! That’s also pretty brain-dead easy. But, I'm writing about ASP here, so let’s move on to that example:

Dim aArray1(), aArray2(), aNewArray(), iArrayCount, iInArray
aArray1 = Array("12","35","45")
aArray2 = Array("334","355","456")
ReDim aNewArray(0)
iArrayCount= 0

' Note that this below is part of a bigger loop where depending on input, I may
' have to add arrays together several times in one go. So, multiply the code below
' like ten times and that's what I'm dealing with.
If (UBound(aNewArray) = 0) Then
   ReDim Preserve aNewArray(UBound(aArray1) + 1)
Else
   ReDim Preserve aNewArray(UBound(aNewArray) + UBound(aArray1))
End If
For iInArray= 0 To UBound(aArray1)
   aNewArray(iArrayCount) = aArray1(iInArray)
   iArrayCount= iArrayCount+ 1
Next
If (UBound(aNewArray) = 0) Then
   ReDim Preserve aNewArray(UBound(aArray2) + 1)
Else
   ReDim Preserve aNewArray(UBound(aNewArray) + UBound(aArray2))
End If
For iInArray= 0 To UBound(aArray2)
   aNewArray(iArrayCount) = aArray2(iInArray)
   iArrayCount= iArrayCount+ 1
Next

I rest my case.

Jun 13, 2005 06:37PM (asp, perl, php, programming, work) Comments (6)

Some Inspiration

Friendly Links