On Tue, Mar 17, 2009 at 1:34 AM, [email protected] < [email protected]> wrote:
> > Thanks for the responses, guys. > > So far I have developed big PHP apps with the Zend Framework, and I > found the apps quite manageable. Yes, it requires some careful > planning to not end up with a big mess of undocumented code, but so > far we always got there ;) > > I think I will look into the "Programming in Scala" Book to get an > overview of Scala, Really great summaries from Charles and Derek. I'd like to see these on the wiki with a link from the Lift home page. I'd like to suggest starting with Beginning Scala<http://apress.com/book/view/1430219890>rather than Programming in Scala. Programming in Scala is a heavier text that is a much broader view of the language. Beginning Scala is shorter and much more of an introductory text (at least the first 6 chapters.) I view Beginning Scala as a gateway drug to Programming in Scala. Finally, the Scala idioms in Beginning Scala are unsurprisingly similar to the idioms in Lift (although I spend very little time actually discussing Lift in the book.) > then the Lift Book. I think it will all come to me > when I develop a small app. Thanks for all your feedback, it's really > exciting to get into this new language. I will stick around and let > you know how I progress. > > Anyways, you guys are an amazing help. I really appreciate that. > > Erik > > On Mar 17, 4:45 pm, Derek Chen-Becker <[email protected]> wrote: > > Over the years I've written a fair amount of PHP code for in-house > > applications (enterprise ticket tracking system, network equipment > > management, etc) and the experience has generally not been great. I think > > PHP functions very well for compact, well-defined apps, but the lack of > > structure in the PHP libraries ends up being a burden to non-trivial > > projects IMHO. In particular, the library is inconsistent and often > > incoherent. As an example, compare database access (pretty common > > functionality) in PHP vs Java. One app I wrote in PHP started out running > > against MySQL and then later needed to change to SQL Server. What would > have > > been a simple database URL change (and replacing a jar file) in Java was > a > > non-trivial search and replace of code throughout the app. I seem to > > remember there also being some functions that didn't correlate between > the > > two driver types. In short, it was a very painful experience. I know that > > Pear and some other facades have been developed to make this more > > transparent, but overall I still feel like the library doesn't have an > > overarching theme. It's more a whole lot of bits and pieces stitched > > together. > > > > Another advantage that Lift has, being built atop the JVM, is full access > to > > all Java libs, and the simplicity of adding libraries as needed. If I > need > > to add SNMP support to my Lift app (network equipment), I just drop the > jar > > file in. To add SNMP to PHP I had to compile a whole slew of libraries > and > > recompile the PHP module. On a similar vein, the ecosystem of Java > libraries > > is (in my estimation) at least an order of magnitude larger and more > mature > > than for what's out there for PHP. > > > > Finally, and most importantly, the "view-first" structure of Lift is > huge. > > It's difficult to overstate how much this can help improve code > organization > > and page structure. Essentially, you're writing a whole bunch of little > > components in Scala and then composing them using pure XML templates. > > Templates can embed other templates, and can embed themselves into other > > templates as well, so you have incredible flexibility in how you lay > things > > out while keeping things fairly simple. The ability to keep your code and > > presentation layer stuff in small, easily digestible chunks is what will > > keep you and your team sane when you tackle big projects. Of course, you > can > > do this in PHP as well, but with Lift the capability is an integral part > of > > the overall design. > > > > You might want to take a look at our demo app for the book: > > > > http://github.com/tjweir/pocketchangeapp/tree/master > > > > It covers a lot of Liftisms (not all), and I'd be happy to answer any > > questions you have about it. > > > > Derek > > > > On Mon, Mar 16, 2009 at 7:29 PM, Charles F. Munat <[email protected]> > wrote: > > > > > > > > > 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 > > > > ... > > > > read more ยป > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://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 -~----------~----~----~----~------~----~------~--~---
