SitePoint Sponsor

User Tag List

Results 1 to 23 of 23
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rails... Nitro... Any others?

    Hi all

    Once again I'm going through the tutorials for RoR... and once again I'm starting to think that Rails isn't for me. Javascript being output from the framework in my mind is just wrong.

    I've decided that learning Ruby, however, is something I must do. Ruby feels right, even if Rails doesn't.

    I've started to look at Nitro, though two things strike me straight away: built-in AJAX, and ORM. "Built-in" is really starting to get on my nerves.

    So, are there any other frameworks for Ruby which are lightweight and don't include ORM and/or AJAX?

    I'm looking for something nice and clean, which just abstracts the page controller/model/views for me, which I can extend and use how I want, with no "great features" fudging things up.

    Please, please don't go on about how great Rails is in this post. I'm looking for alternatives, not my_life_story_in_ror_v1_0.

  2. #2
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If AJAX is built-in, it does not mean you have to use it.
    If Rails has some features that generate Javascript, does not mean you cannot avoid it.

    The ORM is the killer argument for Rails.
    But if an ORM is available, that does not mean you have to use it.

    You are ignorant and arrogant btw.

  3. #3
    SitePoint Evangelist ghurtado's Avatar
    Join Date
    Sep 2003
    Location
    Wixom, Michigan
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it would be very interesting to have a discussion about alternative Ruby frameworks other than Rails. Competition is the mother of evolution, and although it may be tabu for some to say it, not everyone agrees with every paradigm Rails sets.

    Citing an ORM as the "killer argument for Rails" is a bit off the mark, IMHO, since nowadays pretty much any framework any respectable developer would bother to look at would neccesarily put much emphasis into its ORM layer.

    Additionally, not everyone thinks ActiveRecord is the most attractive ORM solution in Ruby. Depending on your style and priorities, Object Graph may be a much more appropriate library for your needs.
    Garcia

  4. #4
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As I mentioned in the other thread, the only weak point in Rails' AJAX offering is the built in view helpers for generating the first half of the AJAX link...i.e. what sits in the client...embedded javascript calls on links and forms etc...I agree this isn't great but there isn't anything stopping you from combinging the Behavior library and the Prototype library to create your own AJAX hooks in an unobstrusive way.

    Rails's newest and killer feature with regards to AJAX is the RJS javascript templates which are simply a form of "view" for ajax actions that dynamically produce javascript to send back to the client. There is a great article on real-world usage of this feature (which is in Edge Rails only at the moment) here.

    I'm not actually aware of any other frameworks besides Rails and Nitro at this point.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As stated, I wanted to keep the "Rails rox" messages to a minimum.

    Not everyone likes ORM. I personally am very comfortable using SQL for what I need, and often use Object Databases and Native XML Databases to get the job done. ORM offers me no benifits there, as there is no 'R'.

    Thats the main reason I'm looking for alternatives to rails. I'm sure lots of people find it very useful to be able to slap an app together in 10 mins or what have you, but I follow a specific process for development which works for me, and I'm hoping to merge Ruby into my methodology. Rails won't fit. I'm looking for something that will.

  6. #6
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rails isn't about "slapping an app together in 10 minutes".

    Have you looked at ObjectGraph?

    Either way, I don't know of anything other than separate components that might be of used to you. There is no framework that suits your rather odd (IMO) workflow that I know of, certainly not in Ruby anyway.

  7. #7
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let me give you one advice: try rails and talk about it later. Lots of people say "I don't like Rails because..." but they haven't tried it. How can you say that you don't like ORM? Have you tried it? Don't like "javascript outputted by the framework"? If you like to type everything, it's ok, you can.

    "Ruby feels right, even if Rails doesn't." Feel before using it?

    ""Built-in" is really starting to get on my nerves." I am a former PHP developer, and this is what my philosophy was. Roll everything myself. Again, try it out and see how cool the "built-in" libraries are.

    You don't want Rails? Fine. Just don't say it is not your thing and it doesn't feel right before trying it.

    And if there is no framework you like: create your own!

  8. #8
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Fenrir2
    How can you say that you don't like ORM? Have you tried it?
    Yes. Doesn't help me much when I'm using a Native XML Database, or an Object Database, as I've mentioned before in a thread you commented on. They're not relational, so object-relational mapping doesn't work.

    It doesn't help me most of the time when I'm using SQL. Consider the following MySQL query:
    Code:
    SELECT
        	f.name,
        	e.id,
        	e.parent,
        	e.child,
        	COUNT(a.orders_id) AS sales,
        	a.referer,
        	SUM(b.totalnet + b.totalvat) AS paid
        FROM
        	roi_sales a
        LEFT JOIN
        	orderdetails b
        	ON b.orders_id = a.orders_id
        LEFT JOIN
        	inventories c
        	ON c.id = b.inventories_id
        LEFT JOIN
        	products d
        	ON d.id = c.products_id
        LEFT JOIN
        	productfamily e
        	ON e.id = d.productfamily_id
        LEFT OUTER JOIN
        	roi f
        	ON a.roi = f.id
        LEFT JOIN
        	orders g
        	ON g.id = a.orders_id
        WHERE
        	g.date LIKE "{$reportmonth}%"
        	AND
        	g.state = 1
        	AND
        	b.reltype != 0
        GROUP BY
        	f.name,
        	e.id
        ORDER BY
        	f.name,
        	e.id
    This is one of the simpler reporting queries I use on one of my applications. This returns a simple array. I have no need to alter this array after I've collected it from the db. Why would I want to wrap it in objects? How would I even start? For me, more often than not, ORM is a waste of time and effort.

    Don't like "javascript outputted by the framework"? If you like to type everything, it's ok, you can.
    I'd rather know that what is outputted is controlled by me. I'd like to know that if there's a security problem with the javascript I can just remove the file from the server and the risk is minimised. I like to know that my system isn't reliant on javascript developed by someone who I've never met, and which I have no quick and easy access to change.

    Also, I've already spent time and effort on a set of javascript libraries which handle AJAX, DOM manipulation, scheduling, and other functions. I'm comfortable with using them. Why should I waste time working with code I don't know very well? I thought the whole point of OOP was to end up with maintainable, reuseable, and indepentant code?

    "Ruby feels right, even if Rails doesn't." Feel before using it?
    I've been through the tutorials. Don't get me wrong, I'm sure Rails is great. But just as purple is great, it doesn't go well with my orange hair.

    ""Built-in" is really starting to get on my nerves." I am a former PHP developer, and this is what my philosophy was. Roll everything myself. Again, try it out and see how cool the "built-in" libraries are.
    Yes, they probably are great. But again, I use XSL as my templating language. I'd rather not switch back to using inline code, as I've found XSL to be a very powerful language.

    You don't want Rails? Fine. Just don't say it is not your thing and it doesn't feel right before trying it.
    Why the hell not? Its only my humble opinion, after all, and shouldn't we share our opinions so that others may learn? Do you think Rails would be here if one guy didn't have an opinion? Or Ruby?

    And if there is no framework you like: create your own!
    Already thinking about it! I'm asking the question, however, to see whether there are any others. To my mind there are about 10 main-stream PHP frameworks. Has Ruby only got 2?!

  9. #9
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ruby has one framework that rules all PHP frameworks if you ask me. ;-). And you may have an opinion, offcourse . The problem is that you want to stick with traditional "best practices".

    XML databases are questionable and relational databases have proven to be better for most things. But if you want to use XML/object databases: you can. You don't have to use ActiveRecord.
    I don't believe that you use advanced queries exclusively. If you want to use advanced queries: you can. ActiveRecord tries to take out the tedious work:
    Code:
    Post.create(params[:post])
    instead of large SQL by hand.
    And you can control all output. You can even create your own XSLT templating system. Instead of .rhtml you use .xslt (you have to plug-in an XSLT library). But Ruby is almost always more powerful than XSLT. And although it makes business logic in templates possible that doesn't mean you do that.
    Have you ever met the creator of Ruby? Do you want to use Ruby? Do you want anything from someone you don't know? The fact that you haven't met someone doesn't mean his code is bad ;-).

    But what should a framework that you like have? XSLT support, no ORM support, no javascript support, just plain MVC structure. It shouln't be too hard to create that. The easiest way would be using Rails and ignoring the features you don't want and implement .xslt templates. The Rails community will appreciate it if you submit it as a patch so it might be in Rails v1.1 .

  10. #10
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    neobuddah-

    I think that you would get along better with nitro over rails. Nitro has an orm and ajax stuff built in but it is much less obtrusive then rails. You can start with a nitro app that just uses the url request/mapping part of the framework and then add in framework features as you want. It even has a great pipeline xml templating system. It would be a good framework to base your work on and transform into something you want to use.

    There are other frameworks as well. There is even a continuations based framework that is a ruby port of seaside called borges. Another good one is IOWA and based on that Kansas. these all have there own ways of doing things so you should investigate to see which one matches your process better. Oh and don't forget WEE another continuation style framework.

    There are also other libraries that just do one part of MVC and you could pick and choose through those.

    But in the end it sounds like you have very specific needs and none of these might work for you in a way you want. Rails and Nitro are the most mature web frameworks for ruby though. Ruby itself is an awesomely powerfull language. And I think part of the reason that there aren't a hundred different web frameworks like php has is that its easy enough in ruby to roll your own.

    It sounds to me like you are already convinced that your custom php solution is exactly what you want already though maybe? If so then why re-invent the wheel?

    I highly recommend ruby as a language to you though and I think you could easily stitch together something to satisfy your needs. i just don't think that anyt one else has the same needs as you so you will not find a prepackaged framework that does everything you want it to do. The beauty of ruby is that it is very easy to do your own thing since the source code will be readable and relatively compact compared to other languages. And that helps smaller teams or even individuals build complex things in less time.

    I hope you find something you like or build something great with ruby though. Just be sure to let us know when you have finished it so we can all play with it and see the benefits your style of development has to offer.

    Cheers-
    -Ezra

  11. #11
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ezmobius: Yes, I have quite specific needs. These are born of experience, and due to the methodology of project tracking I use.

    Thanks for letting me know of those other frameworks. I'll enjoy looking into those. I've also started planning on an MVC framework which should solve my needs when using Ruby.

    I'm quite keen to move to Ruby from PHP. While PHP is great its not as well-rounded as Ruby, and its OO model isn't as advanced. I think I've gone about as far as I can as a developer in PHP without creating my own extensions, and PECL gives me the creeps.

    Someone said to me once that a good developer learns a new language every year. So, 2006, its time for Ruby. Then D. Then Haskell. Wish me luck!

  12. #12
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Welcome to the ruby club. You chose the red pill. You won't regret it.

  13. #13
    SitePoint Addict jamesbond's Avatar
    Join Date
    Feb 2001
    Location
    The Netherlands
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not a full time developer, but have been playing with php for several years. I never really succeeded in making the switch to OOP, MVC and so on. Granted I usually worked on relatively small projects where a procedural style of programming worked just fine for me.

    I've read a bit about OOP, MVC and such in PHP, but to me it's just confusing. Fortunately it seems I'm not the only one who is struggling with this, even the experienced php programmers don't always seem to agree on the 'right' approach

    At this point I'm very inclined to give Ruby on Rails a try. After all these years I think I'm ready to try something new, and hopefully not get stuck like I'm now with PHP OOP.

  14. #14
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rails is probably perfect for you then, jamesbond. It helps you do OOP without getting hung up on patterns, proceedures, and problem domains.

  15. #15
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by neobuddah
    I'm looking for something nice and clean, which just abstracts the page controller/model/views for me, which I can extend and use how I want, with no "great features" fudging things up.
    Are you looking for something for web apps, or a more generic framework for Ruby scripting?

    Douglas
    Hello World

  16. #16
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Web apps mainly, but any generic framework would probably do.

  17. #17
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    neobuddah-

    The author of Nitro has released some great screen casts that show off some of the power of nitro. Its really quite a bit more flexible then rails and you might enjoy it. Have a gander here:

    http://www.nitrohq.com/view/Videos

    -Ezra

  18. #18
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by neobuddah
    Yes. Doesn't help me much when I'm using a Native XML Database, or an Object Database, as I've mentioned before in a thread you commented on. They're not relational, so object-relational mapping doesn't work.

    It doesn't help me most of the time when I'm using SQL. Consider the following MySQL query:
    Code:
    SELECT
        	f.name,
        	e.id,
        	e.parent,
        	e.child,
        	COUNT(a.orders_id) AS sales,
        	a.referer,
        	SUM(b.totalnet + b.totalvat) AS paid
        FROM
        	roi_sales a
        LEFT JOIN
        	orderdetails b
        	ON b.orders_id = a.orders_id
        LEFT JOIN
        	inventories c
        	ON c.id = b.inventories_id
        LEFT JOIN
        	products d
        	ON d.id = c.products_id
        LEFT JOIN
        	productfamily e
        	ON e.id = d.productfamily_id
        LEFT OUTER JOIN
        	roi f
        	ON a.roi = f.id
        LEFT JOIN
        	orders g
        	ON g.id = a.orders_id
        WHERE
        	g.date LIKE "{$reportmonth}%"
        	AND
        	g.state = 1
        	AND
        	b.reltype != 0
        GROUP BY
        	f.name,
        	e.id
        ORDER BY
        	f.name,
        	e.id
    This is one of the simpler reporting queries I use on one of my applications. This returns a simple array. I have no need to alter this array after I've collected it from the db. Why would I want to wrap it in objects? How would I even start? For me, more often than not, ORM is a waste of time and effort.
    A bit of a belated reply but I hate to have someone thinking there isn't a good solution to this.

    In Rails you can create a model for a view and then query against it like you would a normal table. In Postgres you can query a view and add conditionals to it dynamically -- I don't have a clue if this works for MySQL views. For instance taking the classic recipes, categories example from http://www.onlamp.com/pub/a/onlamp/2.../20/rails.html

    Let's say you wanted a view that groups each category by the number of recipes for each one.

    Code:
    create or replace view totals 
    as 
      select c.name,
               count(r.id) as count 
        from recipes r 
       inner join categories c on (r.category_id = c.id) 
       group by r.category_id, c.name;
    In Postgres you can directly query this view and add conditionals, i.e

    select * from totals;
    select * from totals where name='deserts';
    # even cooler, dynamic having
    select * from totals group by totals.count, totals.name having(count > 1);

    In Rails you can create a model for the view code:

    ruby script/generate model Total

    In your controller:

    Code:
    def some_action 
      @totals = Total.find(:all)
    end
    
    def some_other_action
      @totals = Total.find(:all, :conditions => "name = :name")
    end
    And then access the elements of the model as normal in your view .rhtml file, i.e
    Code:
    Totals: <br />
    <% for cat in @totals %>
      Category: <%= cat.name %>
      Count: <%= cat.count %> </br />
    <% end %>
    So with Rails you start with excellent CRUD support with the ActiveRecord ORM and with views you can get around the sticky issues of complicated queries that goes along with reporting. Now admitidly I haven't done the kind of complex reporting in Rails+ActiveRecord+Postgres that I've done with Java+Ibatis+Oracle but the potential is there and it's looking good so far.
    Last edited by kuato; Feb 1, 2006 at 13:46.

  19. #19
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kind of an old thread to post to kuato.

    But anyway, what if a rdbms with no view support is used ? Like, say ... MySQL ?

  20. #20
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by bonefry
    But anyway, what if a rdbms with no view support is used ? Like, say ... MySQL ?
    MySQL supports views.
    http://dev.mysql.com/doc/refman/5.0/...iff-views.html

    My host (dreamhost) is at version 5.0.18

  21. #21
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bonefry
    Kind of an old thread to post to kuato.
    Yea, but it's good info is it not?

    But anyway, what if a rdbms with no view support is used ? Like, say ... MySQL ?
    Do as Vinny said or you can always use the find_by_sql like

    totals = Recipe.find_by_sql("
    SELECT c.name, count(r.id) AS count
    FROM recipes r
    JOIN categories c ON r.category_id = c.id
    GROUP BY r.category_id, c.name")

    But this is a pretty messy way to organize reporting queries, especially when you are talking about multiple joins where the query can span 20+ lines.

    Great thing about views is that your queries are in the database and multiple client apps(say one RoR, one PHP, one Java) can use the query to present the relevant data without every client having to write a hardcoded query like above. Maintaining the views means it's done in one place.

    Keeping logic in the database is something Oracle and Postgres users have known about for years. Even though I'm not a big fan of MySQL it's good to finally see it catching up on views and SPs.

  22. #22
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    MySQL supports views.
    http://dev.mysql.com/doc/refman/5.0/...iff-views.html

    My host (dreamhost) is at version 5.0.18
    Yes, I know, but until version 5.1 it is considered experimental by many, and many clients I work with still use version 3.

    Kind of a pain if you ask me, considering views are something from the stone-age, and even early versions of FoxPro know about it.
    But we must work with whatever we get, and years will pass until MySQL 5 will be adopted. This is a drawback of being widely used.

  23. #23
    SitePoint Enthusiast
    Join Date
    Jan 2004
    Location
    Manchester
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks kuato. I'll look into that.

    At the moment I'm looking further into Ruby on its own, without a framework. Rails was developed as a solution to a problem for a particular company (37signals).

    While it works for them (and lots of others) I don't feel it will suit my needs. So, following the same principles, I'm learning the ins and outs of Ruby while I think more about my problem, and hopefully a solution will be forthcoming. And once I have that solution, I'll probably release it in the hope that it will help others.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •