PHP is a language that's easy to learn thus easy to get started with. 
But down the road, that ease comes with a steep price unless you are 
very disciplined about establishing protocols for coding and sticking to 
them. It is very easy to end up with unmaintainable spaghetti code. I 
speak from painful experience.

PHP grew up by aggregation, thus it has an odd mixture of syntax and 
conventions, some from Perl, many from other languages. Very little is 
consistent. Not surprising from a language originally called "personal 
home page" -- though PHP coders don't like to be reminded of that.

In short, PHP is fine for small sites and quick prototyping, or solving 
some minor problem, but I wouldn't recommend it for anything serious. 
Yes, I know that Facebook and many other big enterprise apps are written 
in PHP, but just because it's possible doesn't make it wise.

Ruby and Python are dynamically-typed languages that typically run in an 
interpreter. Ruby in particular is very open, providing unwary coders 
with more than enough rope to hang themselves. They have very different 
styles. If I were doing it all over again and choosing between the two, 
I'd probably choose Python. I think it has more staying power (not least 
because of Google). And there are some very interesting frameworks 
available.

Java is a powerful, statically-typed language that is compiled into 
byte-code and run in a virtual machine. (C# is Microsoft's rip of Java 
after they lost a lawsuit. In many ways it's a better language, but when 
you start later and can learn from the mistakes of your competition, 
then that helps.) Java is fine if you are doing enterprise work and you 
have a team of programmers and deep pockets. But the amount of 
configuration and boilerplate code is absurd (thought slowly improving). 
The sad thing is that the JVM rocks. It's solid and fast. Would that we 
could take advantage of this without all the Java boilerplate.

Enter Scala. Scala does essentially what C# tried to do, but goes one 
better (thus F#). Not only does it compile into Java byte code, but it 
is a hybrid functional and objected-oriented language, so you get the 
best of both worlds (or the worst, depending on your viewpoint). And 
Scala learned from Java's mistakes. Boilerplate is significantly 
reduced. Best of all, you can use the Java libraries and even mix Java 
and Scala, so we don't have to wait another five years for Scala to 
mature. We can get all the power of Java and eliminate most of the hassle.

I'd be remiss if I didn't mention some other options you should look at. 
I think that the abandonment of Smalltalk by its biggest backer is a bad 
sign, but it's a very cool language. Erlang has some great 
possibilities. And there are plenty of others.

Scala, like Ruby, Python, Java, and PHP is a programming language. You 
can write any kind of program in it, including command line executables 
and GUI desktop applications. You can even program for Android in Scala.

Lift, in contrast, is a web development framework. It is a tool for 
building websites. Period. (Well, web services, too, but that's a kind 
of website.) You don't use Lift to build a desktop app. The equivalents 
in other languages are (among others) Rails and Merb in Ruby, Django and 
TurboGears in Python, Seaside in Smalltalk, etc.

The reason you are probably confused is that there aren't to my 
knowledge many very mature web development frameworks in PHP. I know 
they're out there, but they haven't made much of a splash yet. So your 
experience is probably just writing code in PHP and presto! You have a 
website.

With Lift it's very different. You use Maven -- a project management 
tool that can build your project, package it, run tests, handle 
dependencies, and much more -- to create your basic website. Maven sets 
up a specific directory structure which you must follow (you can change 
it possibly, but it's not worth it). Then you build the pieces of the 
site, placing the code in the appropriate places. Lift handles all the 
hard work of getting the request from the user and sending the response 
back. It does this by working through the "servlet container" -- an 
application that serves web pages written in Java (or Scala). I am 
greatly oversimplifying, but this is all you need to know for now.

Lift uses a modified MVC (model-view-controller) architecture. 
Generally, you save your data in a back end database as objects (using 
an "object-relational mapper" such as Lift's Mapper or JPA). When these 
objects are pulled back out and instantiated in memory, that is pretty 
much your "model" (that and some business logic). The view is what gets 
sent back to the user, after it has been populated with data from the 
model. The controller acts as the go-between between the view and the model.

In traditional MVC systems, the request comes into the controller, which 
accesses the model as necessary and then fills in the view and sends the 
response off to the user. In Lift, this has been shifted around into a 
"view-first" approach. First, the view is selected, then the view calls 
one or more "snippets" (lightweight controllers), which negotiate as 
necessary with the model and return XML to the view to be re-integrated 
with the view's XML. (I say XML, but typically it's XHTML, a dialect of 
XML.)

So you use Maven to create the structure. Then you add XHTML to your 
views. When you need to do some kind of programming logic (which you 
*cannot* do in your views in Lift, unlike most other frameworks), you 
create a snippet and put your logic there. If you need to persist data, 
you have the snippets communicate with a database (or equivalent) to 
save the data.

Hope that helps. Others can give you much more detailed explanations on 
how exactly things work.

I will say this, though. Put in the time to learn a framework like Lift, 
and you will *never* go back to PHP. But it will be work to learn Lift. 
There ain't no such thing as a free lunch.

Good luck,

Chas.


[email protected] wrote:
> Thanks for the links, guys. I really appreciate it.
> 
> To be totally honest, I just by luck found out that Lift even existed;
> John Resig did a Tweet that involved a Chat Application using Lift and
> Web Sockets. So I searched for Lift and found the framework. And since
> I make it a habit to learn something new every day for at least an
> hour, I decided to dive right in. After the "Getting Started", I am
> really intrigued. But I am, as I said, coming from a strict PHP
> background. I am, for example, totally unable to tell Lift and Scala
> apart.
> 
> My goal so far is to get knee-deep into Scala and Lift. For work I
> develop high scalability web apps, and I feel like Lift and Scala fit
> right in there. I guess I want to figure out how much of a
> productivity boost I can get from Lift, and if I can do things with
> Lift that are not even possible with PHP.
> 
> I guess this is pretty vague, but so is my idea of Lift ;) I hope it
> gives you an idea of where I am coming from. What I would really
> really love to see is a comparison between the Lift Framework and the
> Zend Framework, or Scala and PHP.
> 
> Thanks for your attention. I really appreciate all the input and help
> coming from you, it makes it that much easier to wrap my head around
> Lift and Scala.
> 
> Erik
> 
> On Mar 17, 9:34 am, "Charles F. Munat" <[email protected]> wrote:
>> I like the Programming in Scala book quite a bit. The index isn't as
>> good as I'd like it to be, and I wish it had a bit more on Scala Swing
>> (I'm building a Scala desktop app), but having the PDF version makes
>> searching easy, and the dead trees version is a permanent fixture in my
>> bathroom (where else does one read dead trees books?)
>>
>> Be sure to check out the online APIs for both Scala and Lift:
>>
>> http://www.scala-lang.org/docu/files/api/index.htmlhttp://scala-tools.org/scaladocs/liftweb/1.0/
>>
>> Another useful thing is the Java tutorials. Lots of Scala stuff is based
>> on Java, so you can fill in gaps this way.
>>
>> http://java.sun.com/docs/books/tutorial/index.html
>>
>> (You can access the relevant Javadocs from the Scaladocs.)
>>
>> I've been doing most of my Lift work in TextMate, but I'm working on my
>> desktop application in NetBeans and that's working reasonably well --
>> after several false starts.
>>
>> And of course, there is this list, without which I would have abandoned
>> Lift long ago. It is difficult to overestimate the generosity and
>> sincere helpfulness of the Lift team. I think everyone here wants Lift
>> to succeed, and they're willing to put forth a lot of effort to that end.
>>
>> Where you go next depends on where you want to be. Surely you have some
>> goal in mind and you are not just idly learning a new language. What is
>> that goal? If we know that, perhaps someone here can suggest a second step.
>>
>> Good luck. Thanks to the hard work of David, Derek, Tyler, Kris, and
>> numerous others, there's a hell of a lot better and much more
>> documentation than when I started with Lift a year ago (though it's
>> never enough, is it?). Go forth and prosper.
>>
>> Chas.
>>
>> David Pollak wrote:
>>> Erik,
>>> What would you like to learn next?
>>> Perhaps we can continue to enhance the Lift mind-bending if we know
>>> which direction to bend it in.
>>> Thanks,
>>> David
>>> On Sun, Mar 15, 2009 at 5:29 AM, [email protected]
>>> <mailto:[email protected]> <[email protected]
>>> <mailto:[email protected]>> wrote:
>>>     Hi guys,
>>>     I finally managed to work my way through the "Getting Started"
>>>     examples. I am getting an impression of Lift, and I must say I am
>>>     absolutely amazed.
>>>     Now, I come pretty much from a PHP background. I did Java and Haskell
>>>     (once a long, long time ago), I dare say I am a pretty good JavaScript
>>>     programmer, but after reading through the "Getting Started", I realize
>>>     that I have a lot of work to do until I can truly appreciate the power
>>>     of Lift (and Scala).
>>>     I don't know where to continue, though. Do you guys know any good
>>>     references (books, blogs,...) where someone like me can go now to
>>>     increase my knowledge? I guess I could hack together a small app, but
>>>     I feel like I am too stuck on my PHP perspective of things and don't
>>>     really know how to productively program in Scala and Lift.
>>>     So, any references, book recommendations, and so forth, would be
>>>     GREATLY appreciated. And, once again, amazing work from what I can see
>>>     so far.
>>> --
>>> Lift, the simply functional web frameworkhttp://liftweb.net
>>> Beginning Scalahttp://www.apress.com/book/view/1430219890
>>> Follow me:http://twitter.com/dpp
>>> Git some:http://github.com/dpp
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to