DataCruxWeb and Rails

This was originally supposed to be a post about the design and implementation of DataCruxWeb, but I realized comparisons to Rails were inevitable and required some explanation, so I expanded the topic to a full post to get it out of the way now.

First, I need to be clear that I didn't set out to create something that competes with Rails. DataCruxWeb is something I developed to help me with my work. I'm releasing it because I think others might find it useful. I have no plans to try to base all development around what shows up in other frameworks. Of course it's open source, so people can do whatever they want.

Rails seems like a great framework, but I'm not an expert in it so I can't provide a in-depth answer as to how it compares to DataCruxWeb. That said, I think I can identify at least three high-level differences between the two:


1. A DataCruxWeb app revolves around a plain-text model file

The DataCrux.conf model file is used to generate tables and columns, validate input, set default sorting, and will be the basis for future features. By contrast, Rails seems to use the database itself as the primarily source of configuration information.

Personally, I don't like using the database for application configuration because you're somewhat limited by the expressiveness of SQL. I also like the portability of a configuration file. I do understand part of the reasoning behind the Rails approach, which is that you don't want to be bured in mountains of XML config files, but I don't find the database as a good solution.


2. DataCruxWeb is easier to deploy than Rails in many cases

Many discussions I've seen about Rails vs. PHP seems to compare the Rails framework to the PHP language. These discussions usually go nowhere. When I talk about PHP, I'm mainly thinking of it in terms of a platform for deployment. It's very fast and very easy to deploy. By extension, DataCruxWeb is easy to deploy.

I've mentioned this in other posts, but deploying a Ruby/Rails system isn't all that easy unless you're interested in FastCGI or lighttpd. Personally, I want to stick with Apache and I'm a bit scarred by past experiences with FastCGI.

We have number of DataCruxWeb apps running on extremely minimal hardware and the processor is essentially idle most of the time. I'm happy with this. Of course, I haven't pushed DataCruxWeb through a very high traffic site yet, so there may be more optimization to do.


3. You can use PHP to extend or replace behavior

PHP is truly the C of the web. Practically every web developer has had some exposure to it, and even those that haven't can pick it up quickly. I appreciate Ruby from a artistic perspective, but I can't expect everybody to drop what they're doing and learn a whole different set of syntax.

Now, being a Cocoa developer, I am sensitive to the idea of knowing when embracing change is in your best interest. I'm sure a number of developers would have been better off if they had just taken the day or so to learn Objective-C several years ago instead of sticking with C/Carbon. But there's a major difference in that Objective-C is a very small language with miminal syntax.

Ruby is the complete opposite — there is a lot of special syntax. On a level, I find this to be a lot of fun, but that doesn't necessarily mean it's something I want to use for production code, particularly when I work with people that don't share my tastes.

PHP's core functionality may be somewhat flatly designed (thousands of single-purpose functions), but its behavior is robust and predictable. If you understand one PHP app, you understand almost all of them.

This is a rather long-winded way of saying that adapting DataCruxWeb to specific needs is easy because everything is written in PHP. But more than that, it's PHP code that's written with a Cocoa/Objective-C mentality. For example, we don't have:


$pass = true;



Instead, we have:

$options[ 'shouldPassMainObjectToSuccessPage' ] = true;



Likewise, the utility functions look like this:

DCStringIsEmptyOrWhitespace()
DCContainsArrayElements()
DCUniqueIDForObject()



The constants look like this:

DCNewObjectRequest
DCSaveChangesRequest
DCEditObjectRequest



I've seen quite a bit of Ruby/Rails code that would make Cocoa programmers wince. I think these people will find the DataCruxWeb standards more pleasing.


Bottom Line

DataCruxWeb and Rails have different designs. Rails is a more mature framework simply because it's been around longer and has more contributors, but I don't think that makes it automatically better for all situations.

People that want to deploy PHP applications might find DataCruxWeb a better choice for their needs. Those that are more used to the Core Data / WebObjects model may also feel more at home with DataCruxWeb.
Design Element
DataCruxWeb and Rails
Posted Aug 23, 2005 — 13 comments below




 

Jesper — Aug 23, 05 345

This sounds great, and I can't wait to get started with DataCruxWeb. I've tried to get into Cake and Trax, but they're both trying too hard to be straight Rails ports. I'd rather have something like DataCruxWeb that seems to be tailored to the platform rather than forced into it.

Dominik Wagner — Aug 23, 05 346

about php: " but its behavior is robust and predictable" ...
I beg to differ. PHP has big changes even in minor version upgrades. Just look at the Changelog. Total horror.

Rails doesn't use Databases for configuration. It especially encourages the use of YAML for this. So any configuration stuff should be and is flat file in Rails. Of course if you have custom configration on a per user basis, the database might be the better storage for that.

The database structure is delivered using a standard SQL Scheme. And the mapping to objects happens via naming conventions (or if you want you specify the table names in your object classes). So I don't really get what you mean by "By contrast, Rails seems to use the database itself as the primarily source of configuration information." - do you mean the convention that every column in the database table gets a standard accessor in the object without any code?

I agree on the deployment issue. If you run your own server from scratch, and have to compile everything, deploying rails isn't harder than PHP. But since PHP is delivered with most systems in a usable binary form nowadays, and widely available on most ISPs per default, deploying of PHP files is easier. Although there are the issues with the dumb configuration options like "magic_quotes" and stuff...

It's hard to comment on your comparison without having the possibility to look at DataCruxWeb - is it available publically?

Dominik Wagner — Aug 23, 05 347

One more thing:
It's definitely easier to add behavoir with Ruby & Rails than PHP. The language is much more dynamic, powerful and consistent. What kind of behavioural changes do you mean? Do you know that the rails guy first tried to do the stuff in PHP, then rewrote in in Ruby into a smaller codebase in less time, because the language was so much more dynamic?

Mike Zornek — Aug 23, 05 348

> If you understand one PHP app, you understand almost all of them.

I have to disagree with this one. PHP does not lend itself to any conformity or standard architecture. You may have pulled this off this in your framework and apps but it's not something that is native to the PHP language. Just take a look at the major open source PHP apps and you'll quickly realize they are all over the map in how than handle things.

However, in my limited rails exposure their mantra of "convention over configuration" does seem to produce fairly similar architectures that make it easier to pick up new source and grok it.

> I've seen quite a bit of Ruby/Rails code that would make Cocoa programmers wince.

Examples?

-- Anyways, I've anxious to check out DataCruxWeb, seeing as I have Cocoa experience (even CoreData), build PHP web apps for a living and am just finishing the new Rails book. Thanks a lot for releasing it.

Mr eel — Aug 23, 05 349

For context, I develop web-apps with Rails.

> I've seen quite a bit of Ruby/Rails code that would make Cocoa programmers wince.

I would say this as well; I've seens Rails code that would make Ruby coders wince.

Don't blame the framework, blame dodgy coders.

As I see it, Datacrux fills the Model in MVC. Rails is the whole shebang. That might make direct comparison a bit difficult.

I agree with you when you say Datacrux would be easy to deploy in comparison. Rails has some way to go before apps are easy to deploy.

Scott Stevenson — Aug 23, 05 350 Scotty the Leopard

Dominik:

I beg to differ. PHP has big changes even in minor version upgrades. Just look at the Changelog. Total horror.

I don't watch the changelogs closely but I can't remember the last time this actually impacted anything I was working on. Obviously it depends on which modules are affected.

So I don't really get what you mean by "By contrast, Rails seems to use the database itself as the primarily source of configuration information."

I'm willing to say I'm flatly wrong about this. I just got this impression from the tutorials and a conversation I had with somebody. I'll talk about DataCruxWeb configuration in the next post and perhaps you can help me figure out how far off base I was. I still think the model concept in Rails is a bit different.

If you run your own server from scratch, and have to compile everything, deploying rails isn't harder than PHP.

I think you missed my aim in terms of deployment. I'm not concerned about configuration or compiling, but the actual runtime mechanism itself. I don't particularly want to use FastCGI and I really want to stay with Apache. As far as I know, Rails doesn't seem to have a deployment option that fits me.

Although there are the issues with the dumb configuration options like "magic_quotes" and stuff...

That's a one line directive, not really a big deal. :)

It's hard to comment on your comparison without having the possibility to look at DataCruxWeb

Absolutely true.

is it available publically?

Soon. :) Probably around Sept 15. I'm filling in some gaps and cleaning things up. If somebody is interested in absolute bleeding edge, they can contact me if they want something sooner.

It's definitely easier to add behavoir with Ruby & Rails than PHP. The language is much more dynamic, powerful and consistent.

These kind of statements are rather hard to prove or disprove, but I think I phrased the heading poorly. I didn't mean "it's easy to add behavior to a PHP app," I meant "it's easy to add behavior to DataCruxWeb if you know PHP."

What kind of behavioural changes do you mean? Do you know that the rails guy first tried to do the stuff in PHP, then rewrote in in Ruby into a smaller codebase in less time, because the language was so much more dynamic?

This is probably just leftovers from the previous comment, but again this is stuff that is hard to prove, and I'm really not that passionate about PHP in any case. I like Ruby and I like PHP for different reasons. To me, PHP is just like C -- it's out there in the ecosystem, it's simple and it's ubiquitous. DataCruxWeb isn't supposed to be a "Rails/Ruby killer" or anything like that. I'm trying to make this idea clear.

Scott Stevenson — Aug 23, 05 351 Scotty the Leopard

Mike:

Just take a look at the major open source PHP apps and you'll quickly realize they are all over the map in how than handle things.

I meant in terms of syntax, not infrastructure. The paragraphy immediately before that comment specifically called out Rail's myriad of special syntax.

However, in my limited rails exposure their mantra of "convention over configuration" does seem to produce fairly similar architectures that make it easier to pick up new source and grok it

Yes, I'm a fan of this philosophy, and frankly, it impacted the direction of DataCruxWeb.

Scott Stevenson — Aug 23, 05 352 Scotty the Leopard

Mr eel:

As I see it, Datacrux fills the Model in MVC. Rails is the whole shebang. That might make direct comparison a bit difficult.

The Cocoa version DataCrux filled in the Model, but DataCruxWeb does model and a good part of the controller as well. The view layer is mostly left to Smarty, which DataCruxWeb is integrated (but not entangled) with.

Dominik Wagner — Aug 24, 05 353

I don't watch the changelogs closely but I can't remember the last time this actually impacted anything I was working on. Obviously it depends on which modules are affected.

Yes it does. Naming conventions change, etc. Very very many settings are unnecessarily configureable. I had tons of problems with PHP, and I used it since the beginning of PHP3. I still have to maintain some sites where I use pdflib and gdlib, the latter is behaving quite differently in different versions, quite a mess.

...but the actual runtime mechanism itself. I don't particularly want to use FastCGI and I really want to stay with Apache.

What's your grudge against FastCGI? It can be a little bit enervating if you have to do it yourself. But if the main work is done, you shouldn't be experience any big differences. E.g. most ISPs use the FastCGI version of PHP for security reasons.

The paragraphy immediately before that comment specifically called out Rail's myriad of special syntax.[/i|

could you give examples? my main understanding issue with rails was to see how dynamic ruby is. the functions that can be called inside a class definition that modify the class. btw.: the pragmatic programmers book is really the book to read for ruby ;-)

p.s.: i don't want to sound rude. if i do, it's probably the language barrier. i just wanted to jump into the gap of missing rails experience. i have been on both sides, php and rubyonrails, and i won't do any php unless i must to maintain my old sites anymore / or the scope isn't a web application, but merely one function in a website. and one more thing: i don't want to sound like i'm opposed to your framework. essentially a good designed framework can be done in most of the languages out there, also the crappy ones. php has so many inconsistencies, most of the functions lack exactly the thing you would have needed, there is a plethora of functions for almost the same task, their naming is absolutely arbitrary, things like $hash[-1] fail abysmally, this:
[pre]
function MyArray() {
return array('de'=>array('eins','zwei','drei'));
}

// That would work in any decent language I know,
// in PHP it doesn't
$DE_MyArray=myArray()['de'];
$DE_MyArray=array('de'=>array('eins','zwei','drei'))['de'];

// With PHP you have to do this:
$DE_MyArray=myArray();
$DE_MyArray=$DE_MyArray['de'];
[/pre]

Scoping of variables... I could go on for ages. Most of the annoyances I haven't written down, but argued over verbally with my coworkers.[/pre]

Scott Stevenson — Aug 24, 05 354 Scotty the Leopard

Dominik:

I'm no stranger to dynamic languages. ;)

I'd say your comments sound passionate, but not rude. PHP certainly has faults, and it sometimes looks positively offensive next to Cocoa, but PHP made the most sense given the criteria.

As for FastCGI, my last experience with it was on a very high traffic site (4 million+ members), and I just remember we were happy to stop using it. I don't really remember the details.

I do appreciate your comments because I don't have much experience with Rails. I'd rather be corrected than be blissfully ignorant. I'll check out the Rails book. (I'll also make this comments box bigger! yikes!)

Samo Korosec — Aug 24, 05 355

Just a quick question - does DataCruxWeb run with PHP 4, too, or is it PHP 5 only?

Scott Stevenson — Aug 24, 05 356 Scotty the Leopard

PHP 5 only.

nude q — Jul 19, 07 4538

Great site and pretty colors! Elizabeth gracen nude Olsen sex nude Nude universe Angelina joli nude Romeo and juliet nude Alyssa nude model Pamela david nude Leanna scott nude Catherine bosley nude Kates playground nude videos Jason biggs nude Aunty nude Carre otis nude Free rachel stevens nude Nudest magazine Flash nude Nude scenes movies Bobbi billiard nude Nude australians The sims 2 free nude skins Kat dennings nude Karen cliche nude Charisma carpenter nude pics Christina applegate nude pics Demi moore nude video Kendra jade nude Savanna nude Classy nude women Young cute nude Calendar nude Jorga fox nude Dressing room nude Nude nudest Nude uncut older men Almost nude women Nude vanessa williams Wedding crashers nude scene Gena lee nolan nude Pam anderson nude videos Brook burk nude





 

Comments Temporarily Disabled

I had to temporarily disable comments due to spam. I'll re-enable them soon.





Copyright © Scott Stevenson 2004-2015