13 ms·
Lotus, a web framework for Ruby
- ksec 12y agoIt is rather interesting that most parts of Lotus has been posted on HN every months, and yet dont even get more then 10 comment and a few points, not to mention it was never on the HN frontpage. Now all of a sudden it has 241 point. 134 comment.
- emiller829 12y agoThis is a promising start. I've felt for a while now that we need some strong alternatives to Rails for the folks who feel like the Rails Way and the Ruby Way don't always get along. It still feels a bit DSL-centric from the examples I've seen thus far, and haven't dug into things to see what the generated Ruby looks like -- but if it's anything close to simple, this is something that has a chance to become an important part of the Ruby ecosystem. If nothing else, it's great to see things like this because they provide concrete example code for discussions that (IMHO) need to happen.
- jamesbritt 12y agoI've felt for a while now that we need some strong alternatives to Rails for the folks who feel like the Rails Way and the Ruby Way don't always get along. This is why I prefer to use Ramaze. It feels more natural if you're already used to coding in Ruby. It also supports the evolution of development from lightweight to complex sites without having to switch frameworks. http://ramaze.net http://ramaze.net
- jrochkind1 12y agoFor a while, I thought Sinatra was taking that role? It might be interesting to think about what people are looking for that's neither Sinatra nor Rails, or why Sinatra didn't live up to what people were hoping (if people think that). Sometimes I think some of this is just utopian grass-is-greener thinking. While there are _many_ things I'd do differently in Rails if I had the choice (some but certainly not all of which the Rails core team probably agrees with, if they had the chance to start over)... ...I think some of the "the thing we need is something _lighter weight_ than Rails" thinking is basically wishful thinking. When you start with something lighter weight, you (being me) generally find you need more than it offers, and then you've got to go finding your own things to do those things, and when these extra third party things end up not as high quality as you'd like, or end up abandoned by their developers, or you end up spending many hours re-inventing a wheel you're sure someone else has already invented.... either the 'lighter thing' ends up gaining weight, or you end up wishing it had. Doesn't mean I agree with all of Rails choices about what to include, or how to architect it. But I think people under-estimate how challenging it is to hit the sweet spots, as if Rails core team just lacked the will or intelligence or proper understanding or something, none of which I think they lack. Still, certainly alternatives are great, testing grounds for other possible ways of doing things are great, the more different things we see, the better all of our architecting and coding gets, that's the only way to learn.
- pandatigox 12y agoSinatra, in my opinion, gets pretty hacked together after the initial `def get '/'; puts "Hello World"; end` Personally, I think Camping is the perfect fit for Ruby frameworks
- nitrogen 12y agoIt is very possible to organize a Sinatra project elegantly. It generally involves a combination of require_relative and Dir.glob().
- jrochkind1 12y agoThat's interesting; I tend to agree with the crowd that wishes Rails didn't do any kind of auto-loading. But are you suggesting that you need to add a kind of basic auto-loading to Sinatra to keep things sane?
- vidarh 12y agoRails autoloading "just happens". If you're doing explicitly require/require_relative, even on the results of Dir.glob(), the application explicitly specifies what will be loaded, and when. For my part I find that much cleaner.
- auxbuss 12y agoAnother way is to add a file, say init.rb, to a directory and require_relative that. It achieves the same thing, of course.
- Argorak 12y agoOnly if you treat it as a framework. Sinatra is a great library.
- pmontra 12y agoFor any project worth talking about Sinatra is too skinny. Basically you have to hack your routing in about the same way you do with Node's Express, enumerating the bindings between routes and methods. Obviously there are clever ways to do it but you end up reimplementing the resourceful routes of Rails. Another problem is that you really want to use ActiveRecord to access the database. Anything else it too painful. So you end up creating AR models and you have to manually include them. Finally there are views. I won't even enter into that. Soon you end up with a worse engineered Rails. I've been using Sinatra only for serving API requests for small projects. I won't touch it for anything else.
- kureikain 12y agoThank for great fw. I'm by no mean a Ruby expert but finding Sinatra is so simple to create complex apps, and Rails is so complex atm to pick up. I'm making slowly progress in Rails and always not sure if I done thing correctly in Rails way. Lotus seems small enough, and good enouh, balance between Sinatra and Rails for me. Keep up the good work. Thanks.
- liveoneggs 12y agohttp://www.padrinorb.com/ http://www.padrinorb.com/ check it out
- kureikain 12y agoThis is so cool. Built on top of Sinatra. So I can consider it like chaplin to backbone, right? It creates an architecture on top of original framework.
- diegosouza 12y agoMy feeling is the same.
- CarlHoerberg 12y agosinatra is more powerful than you maybe have realize..
- jamesbritt 12y agobalance between Sinatra and Rails for me. Ramaze is that sweet-spot for me. http://ramaze.net http://ramaze.net
- kureikain 12y agoThank you for such a great link. It is also well-maintain. last commit was 2 months ago. Its base is small enough to understand for me too. I like to understand more Ruby by reading the code. However, Rails was so big to me. Thanks again.
- herge 12y agoWhenever I hear lightweight and complete, I always wonder if they handle one of the hardest things to do cleanly in web-apps: user authentication and access control of resources. Does Lotus support this out of the box?
- mmanfrin 12y agoA quick look at the API[1] showed a couple mentions of Sessions in the example structure. Not sure if it is handled out of the box, but I get the impression it is not difficult to implement. But that is just authentication, no idea about access control. [1] http://rdoc.info/gems/lotusrb http://rdoc.info/gems/lotusrb
- diegosouza 12y agoIt doesn't. It's only the base, but a well constructed base.
- fuadksd 12y agoIt doesn't, nor is supposed to. It is composed of small parts with as little responsibility as possible. The idea of Lotus is to not force you to use any tool or favor any kind of approach to such things, but instead give you enough "frame work" to compose with other tools that are responsible for such tasks like authorization, authentication, persistence, or really any kind of stuff you need to do.
- chrisdevereux 12y agoSlightly OT, but as a mobile guy who occasionally toys with server-side programming, authentication is always where I get stuck. I'd like to see some examples of how to implement authentication and sessions cleanly without too much framework magic. Any pointers?
- deleted 12y ago[deleted]
- p8952 12y agoRolling your own? This is as simple as it gets: http://128bitstudios.com/2011/11/21/authentication-with-sinatra/ http://128bitstudios.com/2011/11/21/authentication-with-sina... If you want to make it even easier, use OmniAuth: http://recipes.sinatrarb.com/p/middleware/twitter_authentication_with_omniauth http://recipes.sinatrarb.com/p/middleware/twitter_authentica...
- rhgraysonii 12y agoI'm intrigued. Just signed up for the mailing list. Do you have any links to applications built in Lotus?
- krasnoukhov 12y agoHere is a simple gist from Lotus author: https://gist.github.com/jodosha/9830002 https://gist.github.com/jodosha/9830002 And also there is a WIP room reservation app: https://github.com/sidonath/room-reservation https://github.com/sidonath/room-reservation
- krasnoukhov 12y agoJust found another example app: https://github.com/joneslee85/lotus-blog https://github.com/joneslee85/lotus-blog
- fuadksd 12y agoThere aren't many applications using the solution as a whole - as it was just made public recenltly, but you can check some example applications used for tests in the lotus repo: https://github.com/lotus/lotus/tree/master/test/fixtures/ https://github.com/lotus/lotus/tree/master/test/fixtures/
- deedubaya 12y agoThis is an interesting attempt. It has Sinatra like simplicity, providing the modular architecture that was promised with the Merb + Rails merger. At the very least, this will spark some interesting conversations and ideas.
- Eleopteryx 12y agoThis is depressingly similar to what I was aiming for when I recently began work on: https://github.com/lean-framework/lean https://github.com/lean-framework/lean (I feel like this happens to me a lot.) Rails controllers are hard to test because actions aren't designed to be testable objects. ActiveRecord models become monolithic because there's no separation of instantiation, validation, persistence, or retrieval. I originally experimented with building a Rails app that forgoes ActiveRecord to a large extent; using plain Ruby classes + Virtus gem to separate the aforementioned concerns depending on context. I was pretty satisfied with the number of design headaches I was able to avoid, which is when I started to create a framework around the aforementioned paradigms. Not sure if I just lost my motivation or not, but I'm glad I'm not alone.
- desireco42 12y agoMaybe you just found your kindred spirit and can join forces and produce something awesome for all of us
- Eleopteryx 12y agoI'd be OK with that.
- yid 12y ago> This is depressingly similar In graduate school, many a moon ago, my advisor would say that this is validation of the idea, so one should be happy to be on the right track.
- Eleopteryx 12y agoThanks for the de-demotivation.
- alttab 12y agoI don't see it as such. I see it as "independently arriving at the same, correct solution." This is vision, not just skill. You don't see a lot of that. You probably just got distracted by another, harder problem once you realized you could see the end of the project.
- jaredcwhite 12y agoI'm all for new frameworks that emphasize different ideas and philosophies. If nobody ever tried experimenting with a new approach, we wouldn't have Rails in the first place. So kudos to Luca and his fine work in developing Lotus. I like much of what I see. That being said, I feel like YARWF (Yet Another Ruby Web Framework) is not the most pressing matter in the web space today, and I take exception to the notion that this is a complete web framework. It's not. A complete web framework has client-side components that facilitate two-way communication to/from the server, data binding, HTML5 history state-based page/view swapping, etc. In other words, the type of stuff being addressed by Angular, etc. At this point I wouldn't even characterize Rails itself as a "complete web framework"...it's proven itself to be incomplete and needs something more to be added to it for this kind of stuff. What's the solution? Well, most people in the Ruby world do the typical route of a Ruby + Rails/whatever backend and a JS-based (or CoffeeScript-based) frontend. But I don't like it. I want one language that works on both sides and in fact allows OOP code sharing between the two. That's why I'm so bullish on Opal (http://opalrb.org http://opalrb.org) -- Ruby-to-JS compiler. It may not be perfect, but it's usable and it's here now. What we need is a framework built on top of Opal that is to the client what Rails, or Lotus, is to the server. Then I think we can safely say that we have a complete web framework solution for Ruby. Until then...not quite.
- diegosouza 12y agoYou say "A complete web framework has client-side components", but you don't consider there are action based frameworks and component based frameworks. They follow different approaches. Lotus is action based.
- bliker 12y agoYou are forgetting that not all people are building thick-client applications.
- gnufied 12y ago> I want one language that works on both sides and in fact allows OOP code sharing between the two. I think, having one language in both frontend and backend does not work in long run, regardless of your preferred language of choice. we love ruby and yet where I work - we actively maintain Ruby, Python, Javascript and Java applications. Besides, I find it too hard to write OOP code which is reusable within same problem domain, writing OOP code that crosses the concerns between backend and frontend sounds like inviting lot of problems and lot of useless discussion on - which code goes where. EDIT: I didn't mean business agnostic code can't be shared between frontend and backend btw. Date parsing, uri parsing etc are examples of such libraries. But overall aiming to write business code that can be shared between frontend and backend is problematic.
- chrisweekly 12y ago"We have infinite combinations. Small components have enormous advantadges in terms of reusability." Typo: advantages. Just a nit, but it does stand out since it's in the first bolded sentence on the page.
- chrisweekly 12y ago"We have infinite combinations. Small components have enormous advantadges in terms of reusability." Typo: "advantages". Nitpicking, I know, but it's in the first bolded sentence on the page and it detracts from your messaging. Cool project, good luck! :)
- jamesbritt 12y agoAdditional nitpick: "fewer" instead of "less", as in "... you employ fewer DSLs and ..."
- mrinterweb 12y agoBy what I've seen I like the spirit of Lotus, but I sense a movement away from complete web frameworks to pure API back-ends with the emergence of great single page JS frameworks like Ember. One ruby one that I like is https://intridea.github.io/grape/ https://intridea.github.io/grape/. One interesting node API framework I mean to try is http://loopback.io/ http://loopback.io/.
- joevandyk 12y agoYou could easily use Lotus as an API server.
- fuadksd 12y agoThat's a trend indeed (and personally I like it pretty much). But lotus has a view component that allows you to do stuff """just like rails""" (many quotes intended). That's the beauty of it: it's modular and not opinionated, so you can pick an mix the tools you want to compose in order to suffice your needs.
- awj 12y agoYeah, lotus looks like it could do a good job at letting you share/extend models and other bits of code between a Rails-like html server and a pure api server. Maybe those two things are the same server, different modules in the same server, or different servers sharing libraries. Choice is up to you since lotus looks like it can cleanly do both.
- shime 12y agoYes, I also think that the future of backend development is micro services communicating over defined HTTP API endpoints or other message protocols. If you look closely, rendering presentation layer on the server side and then sending it to the client is a hack and we've been doing it for a long time. It's time for changes.
- h1karu 12y agoSingle page web apps are broken for a lot of the most important purposes that the worlds largest and most important web-apps need to fulfill. For example how could Wikipedia function as a single page app since it wouldn't be consumable by screen readers and robots of various shapes and sizes ? That's just one example, but there are many. What about the semantic web ? microformats anyone ? Google isn't the only search engine out there so the fact that you can use a crutch to let google crawl your site doesn't fix the problem. https://en.wikipedia.org/wiki/Semantic_Web https://en.wikipedia.org/wiki/Semantic_Web http://www.w3.org/standards/semanticweb/ http://www.w3.org/standards/semanticweb/
- jeltz 12y agoTo me the examples look too wordy compared to sinatra or padrino. Like the lack of auto loading though, the autoloading is my opinion a huge mistake in rails and padrino.
- DogeDogeDoge 12y agoHow many of this type of frameworks we had. Padrino was there to fix something but achieved nothing. It is better to focus on rails and fixing rails rather than start a framework for everything. Few doge years ago sinatra was faster than rails, today... not so obvious and still offering much smaller set of functionality.
- vidarh 12y ago> It is better to focus on rails and fixing rails For many of us "fixing Rails" is easiest achieved by starting from scratch. > and still offering much smaller set of functionality. ... and that is why I prefer Sinatra to Rails.
- dragonwriter 12y ago> For many of us "fixing Rails" is easiest achieved by starting from scratch. See, e.g., the road to Rails 3 through Merb.
- moger777 12y agoTheres a bit of politics that get in the way of "fixing rails". Mainly, many things that others consider anti patterns, DHH and other maintainers are fine with.
- CarlHoerberg 12y agosinatra/base, rack-urlmap and sequel, why would you want more fluff?
- krasnoukhov 12y agoIt looks like you're missing the point. As an example, I've built the adapter for DynamoDB[1] so you can throw sequel out in matter of minutes even for existing app, and most likely without any code change. [1] https://github.com/krasnoukhov/lotus-dynamodb https://github.com/krasnoukhov/lotus-dynamodb
- CarlHoerberg 12y agoNo, if I choose Sequel (http://sequel.jeremyevans.net http://sequel.jeremyevans.net) I want to use all the power it gives me, not some lowest common denominator.. Also not all projects needs models, you know, there's other data access patterns..
- matdes 12y agothe concept of a model is not at all tied to a data access pattern unless you subscribe to model = ActiveRecord::Base inheritor in the Rails world. Model is a well-defined term in the domain-driven design world, as in "Domain Model"
- vidarh 12y agoThe presence of Lotus::Model was a red flag to me, until I realised that Lotus doesn't seem to depend on it being used? I don't want my web framework to dictate my model API. Lotus::Model may be great, and I like that it's actually trying to implement the DataMapper pattern, but there are projects where all the model code was written for the backend and we only later decided to expose it as a web API for example, and switching to another model layer would be out of the question. You might want to emphasise more strongly that these components can (assuming I'm right) be mixed and matched with other components like Sequel if you prefer, since the naming sort-of hints that it's all tied together.
- deleted 12y ago[deleted]
- deleted 12y ago[deleted]
- cies 12y agoFeels like Merb all over again! Data Mapper, significantly less code, humble core-contributor. Great work!
- Eleopteryx 12y agoI really liked Merb, and stuck by it for some time. Rails 3 was supposed to be Merb 2. It wasn't really, but Merb was still lost to the "merge".
- tinco 12y agoWeird, I get the idea of defining a new web framework API, but why would you build everything from scratch? There's loads of very good open source code out there. Why not fork DataMapper for Lotus::Model for example? Now you have some dodgy hand rolled library that's probably not seen enough eyes to be really production proof.
- gkop 12y agoLotus::Model apparently depends on https://github.com/jeremyevans/sequel https://github.com/jeremyevans/sequel , which has been widely used in production similarly to DataMapper.
- tinco 12y agoIt seems you are right, my apologies, I clearly hadn't read deep enough. Still, Sequel is just an SQL abstraction. DataMapper is exactly what Lotus::Model is, a full model abstraction over databases, regardless of the querying language. Some years ago I even implemented an XQuery querying backend for DataMapper, it was not much work at all, at a time where AR still had SQL code all through the base and Sequel was just in low profile development.
- dragonwriter 12y ago> It seems you are right, my apologies, I clearly hadn't read deep enough. Still, Sequel is just an SQL abstraction. DataMapper is exactly what Lotus::Model is, a full model abstraction over databases, regardless of the querying language. AFAICT from reading the Sequel code (and especially the code for the existing adapters), there's no real hard dependency on SQL (since the adapter both generates and applies the query string), though there is a dependency on being able to map back and forth to SQL-like operations. It shouldn't be impossible to write a driver for a non-SQL backend for Sequel, though it seems like it would be progressively harder the farther from the assumptions common to SQL its operation was.
- jeremyevans 12y ago
- deleted 12y ago[deleted]
- programminggeek 12y agoI think it's great to see someone make a run at a more decoupled ruby web app approach. I hope it succeeds. In my experience working on Obvious (http://obvious.retromocha.com http://obvious.retromocha.com) it is hard to get Ruby developers behind decoupled architectures because the large majority aren't Ruby devs, they are Rails devs and Rails happens to be in Ruby. Also, the larger group of developers doesn't like the idea of an app being a giant collection of very small objects. It's like there is a gravity to the notion of objects where we think of an object as something akin to a car, not the thousands of parts that make up a car. Last, I think the idea of MVC doesn't place the appropriate number of objects for the different roles in normal request processing. At a reasonable point of complexity really end up with routes, controllers, entities, data access objects or repositories/adaptors, presenters, views, templates, helpers, utilities/libs, and probably some other bits of random code in there somehow. That doesn't fit the 3 role view of the world that is MVC. Lotus does a better job than most of addressing such things, but I think the MVC approach in general falls flat. That lack of appropriate roles means that as programmers we invent a lot of names, patterns, roles, etc. to fit what our code actually ends up doing. That's why you see a lot of service patterns, presenter patterns, etc. being attached to Rails. Everybody is duct taping their approach to the notion of MVC, but very few are saying "what if we didn't see request processing as only having 3 roles?" MVC is better and cleaner than writing a page as one giant PHP file maybe, but I've seen it fall down so many times that I no longer trust it as a useful pattern or abstraction for expressing request processing and HTML string manipulation in code. In fact, if we were building command line apps and writing to files, I don't think we would use MVC at all. But, since we're writing strings of HTML, it's totally different right?
- al2o3cr 12y agoI'm pretty sure they make a pill or something for that scorching case of hasheritis. ;) One problem I have with "decoupled" architectures is that the only way you can sensibly interop with everything from RDBMS to flat JSON files is if you treat the RDBMS as a flat file. For instance, the sample Twitter clone treats every available DB as a plain key-value store.
- 12y ago
- hyperliner 12y agoIs it weird / bad karma to call this "Lotus"?
- mrinterweb 12y agoYou could make an example application called "Notes" with Lotus.
- rbanffy 12y agoOr a spreadsheet and call it "123"... Or even worse - a webmail app called "cc:Mail".
- drivers99 12y agoConsidering that IBM owns the trademark for "Lotus" for software products, I suspect there will an issue with that at some point.
- mdavidn 12y agoLotus::View is the first library for Ruby that marks a separation between view objects and templates. This is a great idea, but Lotus::View isn't the first. See Mustache.rb, for example. https://github.com/defunkt/mustache https://github.com/defunkt/mustache
- SeanLuke 12y agoThis is a textbook example trademark infringement. IBM will not be humored.
- matdes 12y agouhhhhhh, I don't know if that's true. Lotus was never a ruby web application framework. Guess Apple's going to have to change the name of Swift because of that other programming language, amirite?
- SeanLuke 12y ago> Lotus was never a ruby web application framework. A trademark's domain is nowhere near that specific. Recall that Apple was sued by Apple Records because it made devices capable of being used "in the record business". > Guess Apple's going to have to change the name of Swift because of that other programming language, amirite? Interesting that you say this. Apple certainly has a history of trademarking its languages. Apple has trademarks on Objective-C and on AppleScript. Its trademark on Dylan was abandoned and its trademark on Hypertalk was cancelled. I'm guessing that Apple hasn't trademarked Swift because it can't: there are two many other items already named Swift in the area. And the Swift scripting language is hardly a threat to them: it's an NSF-funded research effort.
- jbeja 12y agoIsn't this old, i know i have heard of it several years ago.
- lobster_johnson 12y agoLooks nice. I particularly like the ORM, which seems well-designed compared to ActiveRecord. That said, I have a distinct feeling this is too little, too late. I and my teams have long migrated away from frameworks, to microservices, or what some people call SOA, and we are not looking back. I strongly encourage this design over the old monolithic Rails approach. These are mostly small, highly specialized Sinatra backends that speak data only through REST APIs. For such backends, you don't need views, and you hardly need models; when "deconstructing" your data model into multiple backends, the data model for each microservice often becomes absurdly simple. Mostly you need a simple way to express REST endpoints. Sinatra is very simple and doesn't support any abstraction, but that's mostly a good thing. And you can split your API across multiple files easily. The backends are getting so simple that it's starting to look very tempting to migrate to Go, where we could get real performance and concurrency. On the front end, I would still use Sinatra if it were a classic app -- you can cobble together a "railsy" app with Sinatra by picking your template system, database layer and so on -- but mostly these days we build Node.js single-page apps that are sewn together with NPM and Browserify. Web app development has never been as simple and elegant as it is when done this way.
- jshen 12y agoCan you give done examples of the types of things these micro services do?
- kidmenot 12y ago+1, I would love to take a look at an example or two, as this sounds very interesting.
- stevekemp 12y agoNot the poster, but I've written a few small sinatra-endpoints in my time. For example I wrote a self-hosted comment-system, which is like a very basic disqus service. The back-end is a simple sinatra service that just allows "GET /comments" and "POST comments". (http://github.com/skx/e-comments/ http://github.com/skx/e-comments/) Last week I wrote a webhook-consumer, again using Sinatra. It receives a POST from github, parses the received JSON, and adds some details of the body into a queue for later processing. Both services allow simple deployment and total may 50 lines of code each.
- izietto 12y agoAt the moment, if I should switch from Rails to another Ruby framework, the killer feature would be a well integrated built-in streaming support (something like Lotus::Live in this case), which nowadays is a must for a web framework; otherwise the stability of Rails and the big community around it (people, gems) would win against this project, as against the many other current Ruby frameworks. Anyway I wish good luck for this project, which was created by a person of the same country of mine (Italy), of the same city (Rome) and which I met at the only Ruby meeting ever done in Rome I suppose, a couple of years ago.
- shime 12y agostop complaining and start a Rome Ruby meetup group. I did that couple of months ago with Ruby Zagreb meetup group. Europe, and especially eastern Europe needs more meetup groups!
- izietto 12y agoI wasn't complaining about it, I just reminded when I met him. I don't feel the missing of meetups, I prefer internet communities (mailing lists, GitHub, HN...)
- pmontra 12y agoRails has http://api.rubyonrails.org/classes/ActionController/Streaming.html http://api.rubyonrails.org/classes/ActionController/Streamin... which I never used. It seems that Lotus::Live isn't ready yet. I can't find any docs for it so I don't know how they compare. Could you point me to an URL. Thanks.
- izietto 12y agoYes, but ActionController::Streaming is not made for long pooling; what I mean is 1) web sockets and/or server side events support and 2) Raisl streaming helpers (models watching, client events, etc.); essentially, the good parts of node.js frameworks. Lotus::Live doesn't exist, it is a name example for the feature of which I feel the missing.