View Full Version : php+mysql vs. Rails+AR initial feelings
bluetechnx
September 1st, 2005, 12:31 AM
Well, I just started my new iternim/entry level web programming position at a *very* small company.
They use PHP/Apache/MySQL, using function based PHP programming (no objects) to write web-applications.
I am no Rails buff and I'm also not completely ignorant to and function based programing and straight mySQL...but the initial taste left in my mouth is plz give me my RAILS!
...I just had to rant, I have such a huge learning curve (what their private php function libraries do, no version control so I have to figure out their storage conventions for ~10ppl sharing files) .........I think I'm gonna have nightmares.
But, some job experience is better than none...even if its bad.
rob
September 1st, 2005, 12:35 PM
Congradulations on your new job!
Once you've seen the light of Rails, its hard to look at all that ugly PHP/SQL/HTML (all mixed together like a casserole) mess we used to call code isn't it?
We still do a little PHP, and may I recommend using ADODB and Smarty Templates to make it a bit more manageable. Using ADODB you'll find yourself writing your DB queries alot better. Also, Smarty lets you seperate some of the PHP away from the HTML.
darkcarnival
September 7th, 2005, 12:57 PM
what is the big plus on using ruby if i may ask :)
steve_d555
September 7th, 2005, 03:34 PM
what is the big plus on using ruby if i may ask :)
Ruby in general, or just Rails?
Rails is quite awesome in that it allows you to create a website with a database backend quickly and easily. Especially scaffold. Scaffold is incredibly awesome.
Ruby in general is just much better because it's purely OO (Object Oriented). There are other small things that make the language 10x better than anything else like iterators and the ease of writing extensions.
bluetechnx
September 7th, 2005, 04:07 PM
I am at work, but will post on this later.
darkcarnival
September 7th, 2005, 10:20 PM
hmm ok then.
i think ill say with php though, nothing against ruby i just like php and actually code clutter doesnt bother me, it makes programming more challeging :)
rob
September 8th, 2005, 12:51 AM
I've been using PHP since 2000, so I feel quite comfortable with it. When I discovered Rails, I found it to be wonderful and used it immediately.
Ruby's a great language. Most of Rails beauty to me comes from it. However, for small projects, and projects that involve complex forms (multi-stage, etc.), I'm convinced still that PHP better suits these. I use adodb, smarty, and structure things with libraries and includes when I use PHP, so I didn't suffer so much from the sloppy tendencies that PHP code tends to have.
That being said though, I think Rails has its purposes. For intermediate to large apps that have simple flows, Rails I think is the best. For small to medium apps with simple and/or complex flows, PHP is better. For big apps with complex flows, its' probably an even toss up.
That's my $0.02 ;)
bluetechnx
September 10th, 2005, 12:08 AM
Well, I have time to post!!! omg.
It's been a hectic first week (I just finished 7 working days today).
With regards to PHP, the company I work at has a global functions.php and dbfunctions.php which house all in-house functions to be used. Most served pages are structured top-down and use these require_once files. I must say everything is done rather well...with a function based approached, php with OO is not used in code (unless I want to...but I'm barely learning php...).
My biggest gripe about what I do everyday is that all the logic for a task such as "show recent blog entries" is done in a file called bloghome.html. At the top of this file is a large block of php which handles actions for the page (edit, new, destroy, comment) and all db queries are created and called as needed. Then the html follows this block. 99% of all php code I've seen follows this convention. So it all looks the same, is rather simple and redunant code that can be churned out...
This is different from the Rails convention of controller and viewer. I suppose you could say "I just like breaking things up", it's easier for me to grasp and focus on. I dont dislike much about the language itself...just how we use it. Things I dislike:
"string1" . "string2" can get ugly, "$var1 $var2" is nicer....
@extract(my_query("select * FROM tblusers where userid=$id")); ...casing convention would be nice between developers...
some people do <?=$name; %> why waste a ; key, just <?=$name?> ...done
can't <? echo "debug info: " $var1 $var2" ?> before any header("Location:/") calls ...I like debugging stuff...
So...I've also started learning Coldfusion (MX?...I dunno what version of CF)...things I gripe about it...
So it's a preprocessor using a JVM...ok...so why do I have to <cfoutput></cfoutput> everywhere I want to output something!?!....AND STILL delimit the variable or function...?
An example:
<!--blah blah here is html-->
<html>
<body>
<p> Maybe I want to do something fun and have a neat dynamic time display and show the users logged in name or something. Lets do that below. ho-hum.
<cfoutput>
<!--- Look a CF comment block in CF delimited code. This NEEDS !--- or else its an html comment, gets scanned by the preprocess and then sent to the client...for shame --->
The time is #DATE_FORMAT(Now(), "MM-DD-YY")# aren't you lucky, #name#.</p>
</cfoutput>
</body>
</html>
Isn't it enough I enclosed vars/funcs in #...# I mean come on, it's like double escaping. And it all has to be WORDS! There are no shortcuts to these tags...there aren't even symbolic operators (that I've read, on chapter 11 of my book).
= EQ or IS
!= NEQ
< LT
> GT ...ect...
...carpil tunnel syndrome here I come (I know I misspelled that, and that...) :)
Ok, so...I just like OO and terseness when you don't lose readability and understandability. I think Ruby gives that (agrees with Rob).
Oh, and for staring at html+php+js UltraEdit32 sux. So long live my 10 min quick install (my usb stix transfer was slowwww) of jEdit the my custom icon set, custom l&f, syntax highlighting that doesn't go into "plain text mode" when I *scroll*. I don't care if Ultra if freeware. jEdit is OpenSource (I've used it for 3 years and have windoze batch files to run and set JVM options and all the above stuff...I like it and the only reason I can customize and do so much is because it's opensource.
Ok I'm done. :) :) any comments, raving or smilies welcome.
That's my, i dunno ~$5.00
darkcarnival
September 10th, 2005, 01:29 PM
code clutter never bother me, it makes coding more challeging ;)
i mean im earning big bucks to code, i might as well earn it ;) yea some of you might give me a odd look but i like hard work, the harder the better i say :D
dont get me wrong i do know other languages but php is my favorite one. i also know vb but the editor for that cost too much for me to use so i never really get more into it as i would have liked to. i want to eventually learn c++ as i always wanted to
guess alli can say is i already am using php, its a bit late to larn the advance concepts of another language now, i mean im still working on php classes ;)
my $0.02 pluys a 5 dollar tip of the day
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.