Showing posts with label code generation. Show all posts
Showing posts with label code generation. Show all posts

Wednesday, June 18, 2008

Mashing it up with dbQwikSite

What is a Mashup? For me it conjures up images of a bunch of cooks, all mashing away at a pot of boiled potatoes. But in the world of web development it means piecing together discreet units of available web functionality into a single integrated application.

Wikipedia defines a mash up as:

Mashup (web application hybrid)
In technology, a mashup is a web application that combines data from more than one source into a single integrated tool; an example is the use of cartographic data from Google Maps to add location information to real-estate data, thereby creating a new and distinct web service that was not originally provided by either source.


Before I say anything more let me show you are screen shot of something I was playing with in dbQwikSite before I looked up the term in Wikipedia.




What you are looking at is a dbQwikSite page that I have in our Real Estate test project in which I added a Windows® Live Map. I had created, almost verbatim, the Wikipedia definition of a MashUp. The listing data is all in the dbQwikSite Real Estate database, but the Map is pulled in from Microsoft. After copying sample code from the Live Maps interactive SDK and fiddling with the custom code a bit, miracles of miracles I made a MashUp in about 15 minutes.

Well that’s not all, check this out. I made this over two months ago, when I was testing Developer Edition. This page uses Google Charts APIs to produce graphs of a data page generated by dbQwikSite.

Here’s another graph… ok, so it’s not a “true” MashUp by definitions. It is using Microsoft’s Siverlight 2 technology which is not a web service, but I didn’t have to know anything about coding graphs, just enough to call the JavaScripts and pass the right parameters. It’s just so pretty, I could not resist showing it off.


So today, it dawned on me, I was creating MashUps and I didn’t even know it. At first I said to myself “Naw, it can’t be that easy, MashUps are the realm of web gurus. I must be missing something.” So off to Wikipedia I went, to delve into the real meaning of MashUps. I stopped reading after I read the example I quoted earlier. “Wow! This is cool!” I thought to myself. There’s something big going on here, code generation plus MashUps what an awesome, powerful combination.

By themselves these web services like Google Charts and Windows Maps are interesting. But they only become valuable when placed within a meaningful context. Let’s face it you are much more interested in a map to the new house you are going to buy than just “a map”. And you are likely much more interested in a plot of your sales than a graph of data that is not yours.

What MashUp developers do is take all these nice “gadgets” and knit them into an application to enhance their applications. These guys are the guys writing the back end processing, digging data out of their databases and integrating these fantastic web services to enrich their web applications. But, wait a minute; dbQwikSite users know that they don’t have to code the back end. The code generator of dbQwikSite does that for you. So we just made the job of creating MashUp web sites magnitudes easier. Let dbQwikSite churn out the back end code and a basic interface then add a few lines of custom code to call web services and we are making MashUps in the blink of an eye.

While I still think that MashUp is a funny term, I do agree that the concept is valid and very powerful. Even more powerful is when you marry that technology to the dbQwikSite code generation technology to web services technology in MashUps. You can produce some pretty advanced websites at lighting speeds by “Mashing it Up” with dbQwikSite.

Friday, May 23, 2008

Smart XSL Snippets: Mini Code Generators

Today we released dbQwikSite 5.3.0.3. By most counts, this is a simple maintenance release but hiding in the list of updates there appears one rather mundane looking item entitled “xsl snippet support”. Looks pretty small and simple on the surface, but this single new feature infers some pretty powerful implications. It means that you can make mini-code generators inside the dbQwikSite generation framework.

Let’s take a closer look at this feature. We call it XSL code snippets. What it means that in any of the 150-plus custom code insert points found in Developer Edition, you can write an XSL(T) template. But this is not a template transforming xml data to format HTML in the browser. These XSL templates work a code generation time and they work against the XML of your project. This is really cool, because it means that you can access all the design information stored in your project model to generate code snippets. It takes a bit of time to wrap your mind around the concept but once you do the implications are quite interesting.

Let’s step back a bit. Let’s say we are working with Developer edition, which in itself is very powerful. What we can do is add in new script code to enhance our generated pages. We can do all kinds of neat things by typing in “static” script syntax into insert points / events. Ok, so we can understand adding code snippets to our pages. But what about a “smart snippet”? One that can write the code snippet for you. One that can know about other pages in your project, one that can react to the design setting contained in your project model. That’s exactly what the XSL snippets offer. And when you think about it, that’s exactly what the dbQwikSite code generation engines does, translates your design setting to code. But what’s extra cool about the XSL snippets is that it is you who defines what is to be generated, rather than the code generation engine itself. Now, that’s pretty advanced flexibility, and you won’t find this type of power in any competing tool. If you are lucky you may get “events” and then only a handful at best. With dbQwikSite you get over 150 “events” and you get smart snippets that can actually generate code themselves.

So why would we ever write a smart snippet. There are a number of situations that make smart snippets indispensible. The first one that comes to mind is to be able to have code snippets that is “project aware”, for example you may want to create code that adds new page flows, but without the names of the other pages, you could not so this, smart snippets can gather information from the project XML. Another situation is to make a snippet that is settings aware, for example you want it to create code differently if the page is secured or not, or if the group has a shopping cart. These are examples where smart snippets can outperform their “static” counterparts. You can write snippets that are not project specific, they are generic and self adjusting between projects. Another example could be a multi-scripting language snippet. For example rather than writing two snippets, one in ASP and one PHP and maintaining, managing and distributing both snippets, you have only one smart snippet, that automatically detects the generation language and inserts the correct language syntax.

Granted, writing smart snippets may not be for everyone. You can get along quite well inserting ordinary “static” script code into your insert points. To write a smart snippet, you need an understanding of the project XML and XSL as well as the code that you want to generate. But if you are into these technologies, you may be interested in a few of the details of the mechanics of XSL smart snippets. To create a smart snippet, you do as you would for any other kind of code snippet. But instead of typing in script syntax you type in an XSL template, and check the box that says this is a XSL snippet. During code generation, your XSL is executed and the output is placed into the insert point that invokes the snippet. Your snippet is passed the entire DOM of project XML, as well as two parameters. The two parameters are the Page ID and the Item ID (when applicable), giving you the context of the call to your XSL. You can easily work your way through the DOM to access Groups, Pages and other project objects to produce the code syntax you need.

That’s it, one small item in a maintenance release, the gives you an extremely powerful capability, a capability that you won’t find elsewhere. And even if you are not up to writing your own smarts snippets others will write and share smart snippets and you can benefit. This is yet another way that we are providing ways for the user community to contribute to the development of dbQwikSite. With our first step about a year ago providing an XML project model, to support for user defined project reports, addition of a plug-in architecture, user definable payment processing page generation, code snippets and now smart snippets. You can look forward to dbQwikSite becoming more powerful and more flexible with every release.

Thursday, August 30, 2007

dbQwikSite 5.2.1.7 –Paves the way to a New Edition

This week we released dbQwikSite 5.2.1.7 this is a maintenance release with a few bug fixes and minor enhancements. Hardly worth writing about, except for the reason behind the release which is far more exciting news. We released this edition because it contains fixes that we wanted to get to the user community, before dbQwikSite undergoes a major change to the code generation engine. This change will introduce new, powerful of functionality for web designers and web developers.


What’s it all about? You’ll get a hint if you upgrade to version 5.2.1.7. In some of the property dialogs, version 5.2.1.7. In some of the property dialogs, you’ll see a new option tab “Custom Events.” This is the essence to an all new “Developer’s Edition”. The Developer’s Edition adds the ability to incorporate your own custom code into your projects. It will offer both “client-side” and “server-side” script support. This means that you can add your own JavaScript to run the browser or add ASP(.net) or PHP code that will execute on the server. We introduce “events” and “insertion points” in this edition. You can add your own code at any of these points to change or enhance generated pages.


If you are a designer, you likely have seen, or used, JavaScript to do such things as create rollover effects, validate form fields, and highlight errors or other dynamic HTML effects. With Developer Edition, you can use provided JavaScript functions or incorporate your own scripts that you write or download from script sites. Web developers familiar with ASP(.net) and PHP can insert their own code “snippets” to change processing on the server side. For example you could change the security authorization or perform server-side validation or calculations. Having the ability to add your code to dbQwikSite code opens the door to creating even more advanced, highly customized applications. Unlike editing the generated code which is overwritten if you regenerate a page, embedded code is preserved between code generations.


Stay tuned to this blog from more breaking news about dbQwikSite Developer Edition and other news about dbQwik products.