The best Web Framework - what makes Lift different
seventhings.liftweb.net
seventhings.liftweb.net
Just like every other "SuperMagic" framework, I suspect there's a lot of pain to be had once you step just a little outside of what it expects you to do with it.
We've all re-written Django inside of Django at least once, and thus have been burned by this sort of thing before. Personally, I think I'll wait to see some big projects written by people other than the framework designers before I agree that this is indeed the "best" web framework.
What I like about Rails is that plugins are mostly pieces of infrastructure, not ready-to-use mini-applications that are hard to customize. And Rack plugins (pieces of middleware, done in a standard/reusable way, contrary to Django's middleware) are just awesome.
I also like about Rails that authentication and admin are not built-in. Lots of plugins available for a quick-and-dirty job anyway.
I also like that defining models and even querying has been abstracted away in different interfaces, and that you can use MongoDB in a similar way as you would use a relational database.
Also, in case you need to decouple the request validations from the models (i.e. forms in Django) without HTML-rendering logic attached (useful at times, but completely getting in your way once you try doing anything complicated); in Rails you can, and it looks and feels cleaner because the field types don't have to be related to stuff you're rendering in the HTML response (i.e. field = forms.MultipleChoiceField(widget=CheckboxSelectMultiple)).
Django is awesome in case you ever thought about using Drupal for a project: much more flexible and dev friendly. But it completely got in my way so many times that I actually thought about writing my own Python web framework; which I shouldn't because people have been working on web-related stuff for the past 20 years.
I think you mean Rack plugins (noted b/c Rake is something entirely different in Ruby parlance).
You could always try Flask or Pylons.
I think you're talking about rack middlewares. Rake is the Ruby make.
As for big projects, well, Foursquare is written in Lift.
2. Proxying ads through your own backend that threads itself? Yawn.
3. AJAX and COMET have pretty standard support. Again, this is left up to you with your Javascript library of choice.
4. Again, this is Javascript work. It might save me a little bit of development time, but I'd much rather be in complete control over the process of wiring my pages together.
5. Calling controls through classes isn't any more designer-friendly than Rails or Django template tags.
6. Pretty sure both Rails and Django have one-click install extensions for form Wizards (Rails might support it out of the box, haven't played with 3 enough lately to know)
7. All of these security principles are taken care of my every major web framework I can think of.
So we have some magic Javascript-generating controls and... that's it. Those are nice conveniences for sure, but a lot of these are uncommon use-cases, and I know I can probably bang-out a Django app to handle most of them in an afternoon, or just pull the real Javascript code I've used to handle these cases a dozen times over in the past.
The condescending attitude and failure to meet expectations means I'll probably never look at this framework again, which is a shame because it seems like it might be neat to toy around with. Too bad.
2. Parallel rendering means you can move to a SOA where different components on the UI are served by different backend services. This can be great if you have a recommendation service, a shopping cart and main content areas that are all served by different systems that may have different performance characteristics.. It also parallelizes the loading of the different parts of the page, which should decrease page load time.
3. Is there good comet support in existing frameworks out of the box? How would you easily update a partial in a rendered page when an object changes in rails or django? With Lift, you can hook up the rendered page (and its events) to server-side Actors... without any boilerplate code. This helps the productivity of development and (AFAIK) is still a rare feature.
4. You do have complete control, it is merely a matter of style. Lift does more things server-side.
5. One of the differences is that you don't need to have "partials", which could be more designer-friendly. I agree that this isn't a huge win.
6. yep.
7. I don't think the "No Direct Object Reference" security principle is taken care of by any other major web framework. It is a pretty big win for security -- because all of your exposed ids are session-specific, whole classes of problems just "go away".
I'm not saying that Lift is to Rails/Django what Rails/Django was to PHP, but it does have some interesting features that set it apart.
Note: I have a bias.
nitrogen [http://nitrogenproject.com/] is worth a look
4. Declarative syntax for dependencies seems much simpler than imperatively updating dependencies in Javascript
5. This one isn't presented very well. Essentially, all server side presentation logic is done in Scala code rather than adding custom HTML generation tags (<iterate>, <if>, etc.). This seems like a win (assuming the Scala syntax isn't awkward to work with) and something that I haven't seen before.
7. I have never seen web frameworks with built in support for A4 and A5
If these are things you have seen in other web frameworks I would be very interested to know where. I'm mostly coming from web frameworks on the JVM so it would be good to know more about what I am missing from frameworks outside of that.
I think your right that this is poorly written and maybe a little off putting. However, I think some of the stuff they present looks novel and useful.
Edit: formatting
<ul class="l:Users.userList"> <li class="user"> <span class="username">shadowfiend</span> <div class="profile"> <ul> <li class="name">Person Name</li> <li class="hometown">Hometown, ST</li> </ul> </div> </li>
</ul>
class Users { lazy val users = User.findAll() def userList = { ".user" #> users.map { user => ".username" #> user.username & ".name " #> user.name & ".hometown " #> (user.hometown + ", " + user.state) } } }
As one of the co-founders and developers of the NOLOH PHP Framework (http://www.noloh.com), I know that we've had many of these features for quite some time, including Comet (we support all protocols including streaming, short-polling and long-polling) with little to no effort on the developer's part, and in many cases significantly less effort than described here in lift.
I have nothing against Lift, and clearly I'm bias, however, the tone should've been less hostile in my opinion. However, maybe the hostile tone is good marketing. It's hard to say.
There's no way we can easily answer you with the "methods" we're using as we implement extensive original research. However, from a developer perspective it boils down to the developer specifying what they want to "Listen" to, and optionally how (streaming, short poll, long poll, etc) and NOLOH then takes care of the rest. For example, http://diffpaste.com/#/717/.
Philip Ross will be publishing an extensive white papers soon that goes into more academic depth if you're interested.
However, I can promise you that as soon as he's done, I'll post it on HN and personally send you a message.
My impression of Lift is that the API aren't self-explanatory at first glance. import SHtml and S, hmmm, I know they do different things but I have to be reminded of what exactly from those packages I need.
I'm surprised no one has mentioned stateful vs stateless and horizontal scaling, yet. These are concerns dpp have addressed in the past but its worth reviving discussion. 4sq seems to be doing fine.
What is neat about lift and the foursquare story are the improvements to lift and scala web dev that come from that camp. Most recently, using MongoDB, devs now have a choice between java interop, casbah, and 4sq's rogue. Lift is an an integral and primary contributor to the scala web dev ecosystem.
Session affinity using the session id works pretty well. Many of the features come from the ability to have actors that propagate their state up to clients.
By corollary, what's being omitted is, the learning curve is steep. Scala isn't super-easy, and Lift dives fairly deep into the more complex stuff - implicits, currying, etc.
Nor is Lift itself all too well documented just yet. Yes, there's two books and a super-helpful community, but the experience is still in a different universe from the lavishly over-documented Spring MVC where you never really have to ask a question.
Exploring Lift: http://exploring.liftweb.net/
Lift in Action MEAP: http://www.manning.com/perrett/
Personally, for Java Web Frameworks there are two I like, for quite different reasons.
The first is Spring MVC. the rest of Spring can go die in a fire for all I care, but the Spring MVC part is quite nice. Used properly it allows you to very quickly write a 'low ceremony but high fidelity' server based system. If you make some simplifying assumptions you can have all the Ajax you want too.
The other is GWT. The authors continually harp on about saving us from Javascript inconsistencies and cross browser compatibility. And, to be honest, I think they have a very good point. Anyone who has done serious web work would have run into cross browser problems. There are some other benefits to GWT, such as moving client state down to the client, where it well and truly belongs. Also the ability to pass real, proper Java objects (or at least pretend that is what you're doing) means GWT would never even notice most of the 'heavy lifting' that other frameworks keep rupturing their disks over - such as parsing form parameters, or having to post forms to the server to get them validated only to have to go back to the client and recreate the failed form... (save yourself the round trip and a square headache).
Now, obviously I'm clueless, but to my untrained eye as a programmer the bits I'd need to put into a Lift app look similar in some respects to the JSP tag libraries. E.g. they are trying to get you to do the programming in the html or xml. The problem is that xml (or any of its bastard love-children) is absolutely awful for doing logic in, which makes it deeply unsuited for that task. The only JSP tag library that I remember being worth mucking around with was some sort of super-duper-table-thingy.
Oh sure, you might not need to use weird variants on tags like <h:form> or <f:u:form> or <z:button> or whatever it was, but is moving the weirdness from the tag into the style/class really that big of an improvement? It is still doing the programming in the wrong place, that is, in the html.
> which case the comparison he likely had in mind is not
> Rails or django, but the plethora of Java web frameworks.
if thats the case i think he's misrepresenting himself with statements like
"the most powerful, most secure web framework available today" and "The best Web Framework".
Just curious, but which other parts of Spring are you referring to here? The core dependency-injection container?
It seems to me that it would be really nice for a developer to be able to treat html/javascript/css similar to the way that developers today treat assembler - a very low-level way to the browser to do exactly what you want, but something that the large majority of programmers don't need to know anything about. So that instead of needing to write html/javascript/css, a developer codes to an api that operates at a higher level (in much the same way that developers of GUI applications code to an api that operates at a high level).
Are there web frameworks that insulate developers totally from html/javascript/css? Is this what frameworks like rails/lift/django give you, at least for a limited domain of applications? Is such a framework even possible? Desireable?
It is so powerful that similar APIs are being brought to mobile phones, e.g. Silverlight / Qt Quick; but for the record, even Silverlight / Flex are a pain compared to plain HTML / CSS (try building customized components sometimes).
The only problem with HTML / CSS is the browser inconsistencies involved and I'm obviously biased here, but it's nothing compared to what I experienced while developing / testing with Java Swing or wxWidgets.
Cross-platform is a bitch, trying to solve it is nice and all that, but you're going to quickly run into the problem of "leaky abstractions". And for the record, I tried GWT and other web frameworks that tried doing this ... I completely hated every minute of it.
Disclaimer: I'm a co-founder of NOLOH
If Java is a necessity, Play! is a breath of fresh air.
You might think: "oh, but this is just rendering, but most of the time is in the models/db/soa". You'd be right in other frameworks. Lift is view-first, so it will figure out what components it needs to serve up based on the view and then parallelize all of the computation required to fulfill them.
[NB I rather like ASP.Net MVC but I use StringTemplate rather than ASPX pages for views].
It may be that Lift uses versatile and air-tight abstractions to accomplish these things, but we can't really figure that out from what's on this site. I recommend that the authors focus more on the principles on which Lift is built.
http://www.scala-lang.org/node/1826
That would take the pain out of deploying an app.
But does it look like people are having fun with Scala? When I learned SML in school, I remembered it was quite pleasant. The syntax was simple, type signatures were easy to read and be understood, and the rules were very straight-forward. Basically, I could fit the entire language in my head.
When I learned Java on my first job, I remembered it was also quite pleasant. The syntax was familiar, and concepts easy to grasp. It was verbose as ever, but hey, as least I could brain dump my thoughts into the source code, and read other people's brain dumps. Then Java 1.5 came with its "generics" that can't even remember it's own type after compilation...
A couple years later we now have this bastard child monster all grown up called Scala with its hybrid parametric P /subtype S polymorphic _ with implicit DSL <: smilies and the ever redundant parentheses and braces still in the control structures of a 201x language with optional .s and () in function calls. Don't even get me started on its suicide note that's called the Scala 2.8 Collections in the standard library.
I'm sorry, but I just don't see how this language eco-system can reach a critical mass with the handful of libraries it has now. Maybe when the tools are up to speed in a few years, smart Java people who are sick of Java will migrate over. It just has way too many rules and surprises.
Sorry, but I failed to understand: is this a web server, a programming language...? I don't exactly get, what it does and for what I should use it.
If the offerings were sold as more direct and straight forward, perhaps it wouldn't have been such a disappointment. I expected more - based on the title.
If you don't shred pages from the designer then how to you retain the same look and feel across pages (eg. Does lift not have templating?)
Also, Lift is not the best framework for me because you have to write HTML and can't use something like HAML.
Sass + Haml + coffescript = WIN!