(Preamble: Don't shout - I don't want to advertise any competing technology here!
)
I am interested whether anybody has experience with Ruby on Rails or pros and cons? Or at least an opinion! The concept seems interesting although a bit to hyped by the authors as far as I am concerned.
So technically, do you like it? Good approach? Ever used it?
-
-
I'd like someone to explain clearly and succinctly what ROR is. Is it an object relational mapping framework (ORM) to allow simplified DB access? Does it build presentational widgets for data, maybe something like ASP.NET's gridview? Is it a combination of these ideas? Or is it something else?
-KF
-
Ive tried it... I have to admint - it has a great wow effect (esp. as seen in "the video"). I like the implementation of the MVC pattern, as well as the overall design of the various pieces (controllers, components, etc., all fit together in a nice way). One other thing I really enjoyed about it was how easy it was to create "friendly urls" using the routes.rb stuff - amazing really.
However, my biggest turn-off was worries about performance. David is steadfast in his "design bias" to using ActiveRecord, which sort of prevents you from using more-than-the-stupidly-simple features of SQL such as (column)-selection(!), joins, stored procedures, etc. I suppose there were some work-arounds, and I could have probably manually put in some hacks to use these but its just a turn-off.
In comparison to ASP.NET 2.0, I think you can be just as productive (esp. because of the great IDE, ala VWD, support). In addition ASP.NET 2.0 lets you use all the features of SQL and supports performance features like caching (with built-in file, sql dependency support!). -
Well, I have zero experience with ROR, but I've been working with assorted object relational mapping frameworks for the last ~5 months and can vouch for the "WOW" factor. If your work demands a lot of data access code, and especially if you're coding against complex, properly relational DB structures, an ORM framework combined with VS.NET can be liberating.
I've been working with a very nice, "100% free" framework called "dOOdads". You can get it here:
http://www.mygenerationsoftware.com/portal/default.aspx
The guy who puts dOOdads together, Mike Griffin, is super-helpful and super nice. dOOdads is really great in how it allows you to throw together a bunch of data access code using an intuitive syntax, while still enjoying transactional support. Coupled with myGeneration, it will generate a complete data access tier that can be easily extended using standard OO inheritance. Having all of the elements of your DB accessible in Intellisense is pretty darn cool.
dOOdads has already saved me much time and pain. Worth checking out!
-KF -
dOOdads has also been a big help to me too. However, that is not all that MyGeneration offers, it generates code for other frameworks as well (like Gentle.NET, NHibernate etc). Plus you can do your own templates (even a RoR one) as it outputs plain text (and with a bit more work, PDF).
-
kenfine wrote:Well, I have zero experience with ROR, but I've been working with assorted object relational mapping frameworks for the last ~5 months and can vouch for the "WOW" factor. If your work demands a lot of data access code, and especially if you're coding against complex, properly relational DB structures, an ORM framework combined with VS.NET can be liberating.
I have to admit that's what worries me about RoR. All the examples I see have no real tweaking, it's a straightforward database table = object and to my mind that's very wrong.
A decent database structure is not going to map directory to your classes and objects.
That's what's put me off looking at RoR *shrug*
-
Another question is: Will it survive?
Maybe it's better to wait until the concepts have evolved and have been built into what we love: Visual Studio and ASP.NET ! -
I'm pretty sure you can build dataset-based objects from VS2003 by allowing the IDE to pull the structure from SQL. Isn't this the same thing?
-
In the publicly availbale demos/videos/flash movies of Ruby it appears as if the templates driving code generation are more matured than in other systems.
For example a feature of Ruby often used to create the "wow" effect is to create a complete navigational web site based on a simple db structure with just one command.
So you get an overview list of entries. An edit page. Validation messages. All that stuff.
I am a complete Ruby newbie, looking into it for the sake of not having not looked into it (- Can I say so? I am from Germany, don't know.
) but I sense that some of the features have been created to cause the "wow" effect but might not validate when building
true large scale enterprise apps.
-
ScanIAm wrote:
I'm pretty sure you can build dataset-based objects from VS2003 by allowing the IDE to pull the structure from SQL. Isn't this the same thing?
dOOdads is a whole lot more than just an ORM framework -- it also provides:
+ ad-hoc creation of DB transactions in the IDE , without resorting to stored procedures
+ an intuitive and concise syntax for standard DB operations
+ methods that show the SQL that the framework generated for you
+ support for aggregate SQL operations
+ combined with a good OO language like C#, it includes easy ways to modify and extend the generated code. This helps you take the ORM "off the rails" if you need to -- as one of the posters above noted, DB structures don't often make good object structures, and I find myself building intermediate objects that are more sensible than what's generated.
The best way to demonstrate what's so nice about dOOdads is to look at some code:
// Adding a new record to multiple tables with transactional support
TransactionMgr tx = TransactionMgr.ThreadTransactionMgr();try
{
Response.Write ("Beginning transactional database update. <br><br>");
Contentitems content = new Contentitems();
content.AddNew();
content.Con_Title = "This is a new test item for the UW";
content.Con_Subtitle = "New item";
content.Sta_StatusID = 1;
content.Save();
// Using the output parameter of our stored procedure, output the ID of the just-inserted record
int newContentID = content.Con_ContentID;
Response.Write ("Inserted new record to the database. ID: " + newContentID + "<br>");// insert association on a second DB table
Contentitems_ContentitemsCategories conclass = new Contentitems_ContentitemsCategories();
conclass.AddNew();
conclass.Con_ContentID = newContentID;
conclass.Con_ConCatID = 27;
conclass.Save();
Response.Write("Inserted record to table Contentitems_ContentitemsCategories<br>");
tx.BeginTransaction();tx.CommitTransaction();
Response.Write("Wrote transaction to DB<br>");
}
catch (Exception)
{
// In the case of an error, the entire transaction is rolled back.
tx.RollbackTransaction();
TransactionMgr.ThreadTransactionMgrReset();
Response.Write("rolled back transaction<br>");
}
// Example of how to load a business object by primary key
Contentitems myContent = new Contentitems();
myContent.LoadByPrimaryKey(11632);//Example of how to test for null values in the DB
Response.Write("<BR><BR>");
bool IsItNull = (myContent.IsColumnNull("Con_TMPimage"));
Response.Write("Is it null?" + IsItNull);// Using dOOdads to create a complex query without pain.
Even though this is a dynamic "WHERE" query, it enjoys the safety of being encapsulated in a stored procedure.
Contentitems mySelectContent = new Contentitems();
mySelectContent.Where.Con_Title.Value = "%UW%";
mySelectContent.Where.Con_Title.Operator = WhereParameter.Operand.Like;
// adding a tearOff parameter to the complex query
WhereParameter wp = mySelectContent.Where.TearOff.Con_Title;
wp.Operator = WhereParameter.Operand.IsNotNull;
mySelectContent.Query.AddResultColumn(Contentitems.ColumnNames.Con_ContentID);
mySelectContent.Query.AddResultColumn(Contentitems.ColumnNames.Con_Title);
mySelectContent.Query.AddResultColumn(Contentitems.ColumnNames.Con_Subtitle);
mySelectContent.Query.AddOrderBy(Contentitems.ColumnNames.Con_Title, WhereParameter.Dir.ASC);
mySelectContent.Query.Top = 100;
mySelectContent.Query.Load();// programmatically populating a label, Label1, with a recordcount of mySelectContent
int TotalRows = (mySelectContent.RowCount);
Label1.Text = TotalRows.ToString();
// dOOdads' .LastQuery method exports the SQL statement that it automatically generated for you based on the params above
string myGeneratedQuery = mySelectContent.Query.LastQuery;
Label2.Text = "dOOdads generated the following query: " + myGeneratedQuery;
This ORM stuff blew me away when I first discovered it, and reminded me why I enjoy working with computers: with work and effort, you'll periodically discover methods that allow you to work many times faster and more effectively.
-KF -
You forgot that it support multiple database systems as well, not just SQL Server.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.