Awesome Sauce Java Web: A Second HTML Example
Intro
This week, I've been implementing server-side scripting in Awesome Sauce Java. It's been a nice surprise to discover that ASJ will offer dynamic scripting for the web. It's especially compelling because Awesome Sauce will provide the ability to combine the generation of HTML while embedding and including Java logic all in a single language.
HTML with Java in a Scripting Language
The following is a quick sample script I've put together to test some HTML tags with Awesome Sauce Java.
The code looks very Lisp-like, because there's nothing really unique about generating HTML in a functional Java implementation that resembles Lisp. Since Awesome Sauce Java includes a large chunk of 'Lisp as Lisp wed to Java as Java', but in a functional format, it should be expected that anything that doesn't look like Java will look like Lisp.
This first pass function is simply a test of basic HTML functionality. The next phase of HTML development will include calls to external functions to pull data from JDBC data sources. I'll be using the default Derby sample database to pull and render data to HTML from a ResultSet. Will also start showing business rules and logic that affects the HTML generated.
Expect more complexity in future demonstrations of server-side scripting. The nice feature of ASJ Web is that page changes are updated as fast as you make and save them. It changes the standard Java web paradigm. While it isn't new, as there are other Lisp/Java/JVM implementations, it is different and should start to look different in comparison to other JVM languages.
I'm not interested in building a language and application runtime/OS that looks and works the same as other JVM languages & OS's. My hope is that when all is said and done, ASJ will offer measurable advantages in some 1-n features, resulting in improved productivity or greater opportunity to learn for both users and developers.
As a computer user and developer, it seems to me there's a lot of opportunity to save time using computers. Awesome Sauce Java and Hot Sauce is being constructed to apply to improve usability, productivity, and time-savings in both worlds.
Client Side Rendering
One of the things I'm excited to be looking at in the near future, is client-side coding using Awesome Sauce Java. As a scripting language solution, ASJ offers a great deal of dynamic scripting capabilities that makes standard Java not only more flexible, but much more approachable. If web applications can maintain page rendering code and logic on the client side and data logic on the server, it might end up reducing network or bandwidth requirements between client and server for page generation.
An advantage of splitting client and server code, in combination with having all of Java, including JavaFX and Swing, means that clients can not only build web applications for the browser, they can possibly coordinate client apps to share detail between browser and stand-alone Java apps that offer richer interfaces than can be developed in the web.
The same applies to mobile devices running Android, as ASJ will be available to develop apps for Android. By leveraging Intents, apps could offer web interfaces that also leverage native ASJ Android apps for a more comprehensive user experience.
But, before working on the client-side, I'll be focused on getting the server-side functionality in place, tested, and stable. As ASJ matures, it becomes more stable, which allows me to shift gears into the world that it was originally conceived for: Hot Sauce.
More to come tomorrow.
Have a great night!
Michael
This week, I've been implementing server-side scripting in Awesome Sauce Java. It's been a nice surprise to discover that ASJ will offer dynamic scripting for the web. It's especially compelling because Awesome Sauce will provide the ability to combine the generation of HTML while embedding and including Java logic all in a single language.
HTML with Java in a Scripting Language
The following is a quick sample script I've put together to test some HTML tags with Awesome Sauce Java.
(defun fungo-index ()
(html
(head
(title "Awesome Sauce Java with Hot Sauce")
(h1 "Awesome Sauce Java")
(h2 "Server Side Web")
(h3 "A First Example")
(h4 "The next one will have the database code")
(h5 "But this one has math calculations!"))
(body
(h2 "Edible Plants aka Herbs")
(p "This is a collection of plants.")
(dl (dt "Basil")
(dd "Annual. Can grow four feet high.")
(dt "Oregano")
(dd "Perennial. Sends out underground runners.")
(dt "Coriander")
(dd "Annual. Also called cilantro."))
(h3 "Just a random list")
(ol (li "Monday")
(li "Tuesday")
(li 300)
(li 400000))
(h4 "Semantic HTML Tags")
(p "The anteater is " (em "strangest"))
(p "Take a " (strong "left turn"))
(p (code "include \"a\" trans.h"))
(p "The URL for that page is " (samp "www.cern.ch"))
(p "Use the standard two-letter state abbr, such as" (abbr "CA"))
(p "Use the force, Luke" (cite "Star Wars"))
(p "Styles: " (dfn "logical styles"))
(p "Code: " (code "chown") (var "your_name for the_file"))
(h4 "A Table of Very Important Data")
(table
(caption "Vital Statistics")
(tr (td 100.0f) (td "first"))
(tr (td 200.1d) (td "second"))
(tr (td 300) (td "third")))
(h5 "This is just a little heading")
(h6 "And the smallest is the last"))))
The code looks very Lisp-like, because there's nothing really unique about generating HTML in a functional Java implementation that resembles Lisp. Since Awesome Sauce Java includes a large chunk of 'Lisp as Lisp wed to Java as Java', but in a functional format, it should be expected that anything that doesn't look like Java will look like Lisp.
This first pass function is simply a test of basic HTML functionality. The next phase of HTML development will include calls to external functions to pull data from JDBC data sources. I'll be using the default Derby sample database to pull and render data to HTML from a ResultSet. Will also start showing business rules and logic that affects the HTML generated.
Expect more complexity in future demonstrations of server-side scripting. The nice feature of ASJ Web is that page changes are updated as fast as you make and save them. It changes the standard Java web paradigm. While it isn't new, as there are other Lisp/Java/JVM implementations, it is different and should start to look different in comparison to other JVM languages.
I'm not interested in building a language and application runtime/OS that looks and works the same as other JVM languages & OS's. My hope is that when all is said and done, ASJ will offer measurable advantages in some 1-n features, resulting in improved productivity or greater opportunity to learn for both users and developers.
As a computer user and developer, it seems to me there's a lot of opportunity to save time using computers. Awesome Sauce Java and Hot Sauce is being constructed to apply to improve usability, productivity, and time-savings in both worlds.
Client Side Rendering
One of the things I'm excited to be looking at in the near future, is client-side coding using Awesome Sauce Java. As a scripting language solution, ASJ offers a great deal of dynamic scripting capabilities that makes standard Java not only more flexible, but much more approachable. If web applications can maintain page rendering code and logic on the client side and data logic on the server, it might end up reducing network or bandwidth requirements between client and server for page generation.
An advantage of splitting client and server code, in combination with having all of Java, including JavaFX and Swing, means that clients can not only build web applications for the browser, they can possibly coordinate client apps to share detail between browser and stand-alone Java apps that offer richer interfaces than can be developed in the web.
The same applies to mobile devices running Android, as ASJ will be available to develop apps for Android. By leveraging Intents, apps could offer web interfaces that also leverage native ASJ Android apps for a more comprehensive user experience.
But, before working on the client-side, I'll be focused on getting the server-side functionality in place, tested, and stable. As ASJ matures, it becomes more stable, which allows me to shift gears into the world that it was originally conceived for: Hot Sauce.
More to come tomorrow.
Have a great night!
Michael
Comments
Post a Comment