Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Scala Lift wiring give me?

Tags:

scala

lift

I have been looking at the Scala web framework Lift. I recently saw something called Wiring and was wondering if someone could explain the benefits to me, as an application programmer.

like image 396
yazz.com Avatar asked Dec 05 '22 00:12

yazz.com


2 Answers

Wiring gives you the ability to declare relationships among different elements on an HTML page and as predicate values change, the dependent values will automatically be updated on the page.

Think about the difference between a spreadsheet and a Java/Scala program. In a spreadsheet, you can declare complex inter-relationships among cells and when predicates change, the cells automatically update. Writing a program that reflects even a pretty simple spreadsheet will typically run into the hundreds or thousands of lines and be very difficult to maintain.

A concrete example is a shopping cart. Think of all the pieces of a web page that must be updated when you put something in a shopping cart. Writing the initial screen may not be hard, but then think about the maintenance complexity (okay, what do I have to update when something gets added to or removed from the cart, when the zip code changes, etc.)

What wiring gives you is the ability to declare relationships and no matter how the predicates change (e.g., tax rules change based on zip code, but anything that depends on taxable subtotal is updated when the tax rules change), the developer doesn't have to understand all the dependents that must also be updated.

like image 128
David Pollak Avatar answered Dec 19 '22 14:12

David Pollak


Wiring (see demo) makes it possible to have several input fields (or cells) depend on each other and have results automatically passed to dependent cells. – And all of that without a line of JavaScript in a very declarative way.

As you can see in the demo, all you do is declaring how the cells depend on each other and then how they are being displayed. No need to write or call any helper functions in order to connect the cells.

like image 45
Debilski Avatar answered Dec 19 '22 13:12

Debilski