Curl for RIA with AMF

May 22nd, 2009

I was not aware that there was another binary alternative in Binary JSON or BISON. But I have found two places where developers outside ActionScript might want to take a look: the Glare framework for AMF with Smalltalk and the python AMF code.

Regardless, the Curl framework is using an abstract DataObject class with two subclasses: StandardDataObject and DynamicDataObject. It was interesting to see that one DataObject factory method uses
from-traits
    traits:DataObjectTraits

as traits are not much discussed in relation to Curl.

The supported types are bool, null, String, int, double, DateTime, DataObject, Array, ExtendedArray, ByteArray, AMFXmlDocument with the latter being just a wrapper for a String of XML. An ExtendedArray used to obtain a DataObject from a ByteInputStream or to put to a ByteOutputStream with its AMFSerializer and AMFDeserializer children.

Here is the default constructor for the DataObjectTraits:

{StandardDataObjectTraits.default
    name:String,
    members:StringArray,
    dynamic?:bool = true,
    externalizable?:bool = false
}

so this look very approachable. But it has nothing to do with Traits as in Squeak or Scala. Traits were introduced to help structure the refactoring of code in a way in which categorizing methods could not. Traits are classes which are not intended to have instances but which can implement methods. That is a very natural thing in Curl, but without a refactoring browser, their usefulness as an explicit cosntruct is dificult to demonstrate (an Eclipse plugin might be in the offing.) The Curl 7.0 introduction of a library access modifier should make naming classes with Trait more meaningful.

Now to get BlazeDS running on my Apache localhost.

CurlUnit and Curl site-specific browsers using the Surge RTE

May 21st, 2009

Over at LogiqueWerks there are 2 new links on my Curl 7.0 page: a live page running unit tests against Curl project in a test runner UI (just click the RUN button) and the project beiing tested: a simple SSB (site-specific browser.)

I have come to rely on Mozilla Prism for the sites at which I make daily changes: but I know that Curl offers a an enterprise SSB alternative to GreaseMonkey. And I can see a Curl GTD browser that makes TiddlyWiki seem lame in comparison. Let 42 useful browsers bloom!

Three more open-source projects for the Curl RIA platform

May 15th, 2009

Over at sourceforge.net there are 3 more open-source projects for Curl. One is for a Curl MVC framework and as of today has no available downloads. Another is a non-visual Curl library with packages such as CODEC and packages with utility procedures such as
{visit-super-classes}.
The third package is a Curl-Java project to facilitate communications between a Curl client and server-side Java (both using the Spring framework and the Japanese Seasar2 AOP framework.)

The two projects with available downloads are for Curl 6.0 at this moment and do not yet have detailed English documentation. I had no problem deploying the LIB project as as to be able to install 6.0 documentation for the Curl Documentation Viewer. The ORB project has pre-compiler pre-processed pcurl code files containing standard Curl docs.

The ORB project includes both Curl and Java directories along with a curl-orb-client.jar which has classes such as CurlSerializableStreamWriter and a set of server-side JAR files including curl-serializer.jar and curl-orb-server.jar From what I can see, the object request project includes code for generating mappings between object instances in Java and object instances in Curl.

This attention to the j2ee server-side should help move Curl towards the goal of Curl as a secure enterprise platform and not just a mature web-content language for the client-side.

Curl 7.0 RIA platform released May 7, 2009

May 10th, 2009

The latest Curl from Curl Inc. is now available as both Runtime and developer IDE or Eclipse plugin for Windows and Linux (both as rpm and as deb).

If you are a developer looking at the Curl platform you will not want to miss the example code ZIP files in the docs/default/examples directory. It is found under your install below /Surge/8/docs ( the “8″ because 7.0 is known internally as curl8, rather as you started your 2nd year on your 1st birthday.)

The most significant change for me as someone who has worked mostly in Curl 3.0 is the “library” access modifier which allows packages under the same project manifest to share code ( so we have private, protected, package, library and public.) I recently worked on a framework where this would have helped keep classes in separate packages which worked with each other across component layers. And this means we have the syntactic-sugar of “library-get” and “library-set” for ease in declaring accessors.

As most often in the past, Curl 7 installs so as to co-exist with Curl 3.x, 5.x or 6.x either as RTE or also with IDE’s. If you have seen a Curl installer in the Windows Control Panel you will know that it is very selective as to what you can uninstall or retain among your Curl versions.

I had been hoping to see an option to “disable selected breakpoints” on that Debug pane, but there are now large, obvious buttons with dropdowns on the IDE for flipping from one edit point back to another which is helpful when refactoring code across scurl source files.

The best kept IDE secret is that a right click on an edit pane tab gives you the option to “split” right or top ( the menu has an option which defaults to split to the bottom.)

With the TextMate knock-off for Windows and Linux, E, now going open-source for linux, I will want to try using E. But Curl also comes with an emacs site file and offers an Eclipse plugin for the Curl language.

Curl Inc. is now positioning Curl as more of an RIA enterprise platform than a web content language (Curl is usually presented as HTML + JavaScript + CSS) and now has more options for using JSON, JavaScript, Flash and Flex. There are a few Curl open-source packages now for XML as a data format, for SQLite and for UnitTests among others. I have not checked yet whether Curl embedded as an HTML Object now accepts Object parameters – the lack of which had been a pet peeve of mine … or whether there is now more complete documentation of the API for Curl sub-applets.

I am glad to be able to say that the Curl RIA demos at the Curl home page are not “toy” applications as can be seen with the dynamic “social network” applet for FaceBook or the impressive Timeline demo. In addition, there are code examples available elsewhere on the web for advanced Curl UI’s.

In a few days I may have a chance to look at writing Mixin classes in Curl and see what has become more comfortable with the “library” access modifier for code common across packages for code which is not public or protected (Curl allows multiple inheritance and constructors are of the “factory” pattern.)

With the renewed enterprise interest in Smalltalk, the re-emergence of the “Slate” project as “Clean Slate Smalltalk”, the fine Seaside web framework, traits from Squeak Smalltalk and the good work done on the Io beyond-Smalltalk language, it is nice to be able to say that the only web programming environment which I think can rival Curl is a multi-platform dialect of Smalltalk. Curl allows you to relax all typing and do your prototype and then get down to re-writing your application as an industrial-strength web or desktop app relying largely on static types. All that I miss in the Curl IDE is a Smalltalk-style refactoring browser …

In my many years working on mission critical applications first in both Curl and Smalltalk, Curl is as productive for experienced developers as Smalltalk and just as well-suited to evolutionary approaches to software development. Both promote: “See, Yes you can! Just like this …” And after that short turn-around demo or prototype, we can get the app right with UnitTests, an excellent debugger, live documentation and then get it fast with the profiler and the HTTP monitor. And have the option of using Curl itself as the data format. And now Curl stylesheets as well (Smalltalk Seaside is also not married to HTML.)

If you have not yet looked at Seaside for Smalltalk and you are doing web applications, you owe it to yourself to do so. It you are interested in the desktop or in site-specific browser applets, then Curl is a must-see, must-try. Then if you opt for Air or Silverlight or yet another framework, library or platform, you will make that choice knowing what you have passed up. Just as you may have thought you knew why you ignore PROLOG for business rules, you may just not know about Logtalk or the latest on constraints in distributed Oz. These are not just languages: Curl as much as Smalltalk, Erlang or Oz offers an approach to getting from a software vision to a maintainable product with manageable risks and a good chance of being within budget. But as much as Smalltalk or Rebol or UNICON you must be ready to set aside preconceived notions – and I think that it helps to embrace evolution as a fact: your prototype need not be a throw-away but you must have the discipline to move beyond exploratory and feasibility mode to the demands of industrial-strength components. Curl offers restrictions at the code package level which would offend most Smalltalkers. But it is worth it in my experience. Start modeling your web app in a declarative mode with no type restrictions. And then get beyond that.

Busy with Curl and RDF

November 7th, 2008

I am hoping to post a substantial note on the Curl language and RDF over at eclectic-pencil.
Tim Berners-Lee was involved in the original Curl language project and of course is now involved with RDF efforts for the Semantic Web such as the N3 language for expressing RDF triples.
Btw, I see that INRIA.fr has a SweetWiki powered by SmallWiki (now known as Pier)
Technorati Profile

On Improving Curl

October 26th, 2008

Over at my Curlr blog I have added some suggestions for improving the quality of Curl code by enforcing some coding standards.

At the moment in a Curl file containing a class definition, class-side and instance-side expressions can occur willy-nilly.

Some developers have the idea that if a field is only referenced in one method, then declare that field where the method is declared. And declare class-side variables wherever you will.

As Curl still lacks a refactoring browser, this generous approach to coding-as-scripting can and does add to maintenance headaches.

I particularly like my own idea of {i-attributes } and {d-attributes } as those declared once -and-only-once as requiring to be initialized in a constructor or not.

These are not substantive changes such as adding co-expressions or generators as found in ICON and UNICON or becoming more truly multi-paradigm as is distributed OZ. What they address are some of the needs of PITL. In a large codebase, it is important to be able to grasp the intention at a glance so as to move on in confidence (no obvious issue there, so look elsewhere) when refactoring code without the craftsman’s tool.

What I have proposed is not a restriction, but rather only an option to be enforced as a tighter compiler-directive than stringent? is at present.

While never a big fan of UML, I have opted to suggest rational? = true for this meta-level view of Curl class code.

Sometime ago I suggested that a macro for SCURL file headers was overdue. I now have that suggestion:
{curl-class }

What this will mean is that when the header is found, that SCURL file may only contain one Curl class and only a Curl class (no stray globals, proc’s and other flotsam-and jetsam.)

Call it “Curl with class”. || humor

Curl Enterprise Framework: refactoring and sub-applets

September 28th, 2008

At LogiqueWerks I have replaced the first Curl 6.0 revision of Paul Sheehans ‘Curl Enterprise Framework’ by a slightly re-factored version which uses only the documented sub-applet API’s of Curl 6.0

The original code accompanying the book ‘Enterprise Curl‘ relied on a package ‘IPC’ for inter-process communication which relied on largely undocumented Curl internals. One problem not solved in the port of the framework to Curl 6.0 was that of communication with such transient items as the ’splash screen’ when launched from HTML so as to avoid

Error: InvalidAppletException: Unsupported content-type 'application/octet-stream'

arising from the internal Curl call to Applet.load-next-aux

In the most recent refactoring, launching ‘enterprise-parent.curl‘ results in parent-child calls between that applet and the AppletData of enterprise.curl. However, launching ‘enterprise.curl’ from HTML proved more of a challenge. To allow a simple callback, the package ‘logon’ has now moved within the ‘VMS-MOTORS’ package as has the one ’splashscreen.scurl’ formerly located in a SERVICES package.

In the case of ‘enterprise-parent.curl‘, a parent-callback is used to launch the logon dialog once the splashscreen has run its course. In the case of embedding in ‘enterprise-curl.html‘, the child applet is controlled from a JavaScript function with a call to ‘applet_invoke‘.

The one drawback is that now the Help menu cannot call upon the same SplashScreenManager class to provide the ‘about’ dialog.

The framework is now reduced from 13 to 11 packages. The logon.scurl arguably belonged with the SplashScreenManager in the application code found in VMS-MOTORS where both now reside so as to avoid circular imports from the WINDOWS package.

While the splash screen for ‘VMS MOTORS’ may not be the best illustration of the sub-applet model in Curl, the upside is that there is now a working example which does not use imports from CURL.REMOTE or make explicit reference to ‘remote-connection’ and undocumented Curl such as
{import * from CURL.REMOTE}
{define-remote-class public abstract open ParentInterface
{define-remote-proxy-class ParentProxy}
{define-remote-yxorp-class ParentYxorp}
{remote-method public abstract open {mention-string str:String}:String}
}

But what is available by running ‘enterprise-parent.curl’ with a breakpoint at
set ad.applet-invoke-ready-callback
in the Logon method
{method public {startup-with ad:AppletData}:void
is a view of the underlying sub-applet API features of Curl 6.0 such as
the connection – a TunnelRemoteConnection
the proxy – a TunnelRemoteProxy
none of which are exposed in using only the published API found in the IDE documentation and illustrated in the IDE extended examples.

The LogiqueWerks page also has a link to the example ’shape.curl’ and the various JavaScript tips to be found in ’shape-parent.html’ for the use of AppletData.

The new EnterpriseFramework code now contains an example of a subclass of AppletHistory which might also be of interest.

Several cosmetic features of the example UI for ‘VMS MOTORS’ will see a re-work in the days and weeks to come as my work commitments permit.

Oz 1.4.0 released at mozart-oz.org

August 10th, 2008

Oz 1.4.0 was released about a month ago at mozart-oz.org but there are as yet few changes evident at the web site.
For example, the documentation still discusses enabling Oz applets for Netscape … with no mention of any other browser.
The Oz team has been working on enhancing Oz as a language for distributed systems. Here is a quote from mozart-oz.org:

The Mozart system provides state-of-the-art support in two areas: open distributed computing and constraint-based inference. Mozart implements Oz, a concurrent object-oriented language with dataflow synchronization. Oz combines concurrent and distributed programming with logical constraint-based inference, making it a unique choice for developing multi-agent systems. Mozart is an ideal platform for both general-purpose distributed applications as well as for hard problems requiring sophisticated optimization and inferencing abilities.

Oz may be best-known through the MIT Press book by Peter van Roy, known on lambda-the-ultimate as CTM. You can find a list of related papers on Oz at http://www.ps.uni-sb.de/Papers/ among other work of his colleagues. If you have Joe Armstrong’s book on Erlang or remember any Prolog, you might like this book on Oz as a multiparadigm language.

The programming interface of Mozart remains Emacs. After installing Oz, the Oz menu on your Emacs toolbar will now include a Distribution Panel in addition to the debugger and profiler.

O’Reilly has a book coming on real-world Haskell: a book on real-world Oz is over-due.

The next major Oz event will be the (eventual) release of Oz 1.5.0 by which time we should have Rebol 3.0 and a new version of dataflow for Rebol from Liquid Steel tools.

Really cool Curl

September 13th, 2007

I was pointing out JSForth to a developer on-line (Forth interpreter in JavaScript) which I thought was cool but then I see this in Curl: a folding coding window in a web page.

Here is the Curl 5.0 code for the applet:


{curl 5.0 applet}
{curl-file-attributes character-encoding = "windows-latin-1"}
{applet manifest = "manifest.mcurl"}

{include "./utils/guide-header.scurl"}
{include "./utils/support.scurl"}

   {x-example-ref
        title = "Folding Tree example",
        {url "./examples/RIA_with_Curl.curl"}
    }

What this does is create a labeled hotspot on my page: with one click an entire Curl client-side scripting environment opens. The running example is there; the code that is running is there; buttons to execute, save applet; revert changes; close popup – and the panel allows editing the script.

Clicking on ‘Execute’ causes a popup version of the script to run with your changes.

I had seen this cool way of working with code as part of the example macro

{example

}

What was new was the ‘expandable’ and ‘collapsible’.

I cannot imagine this being more concise in JavaFX or in Groovy. Here is the Curl procedure from the include file:


|| Copyright (C) 1998-2006, Sumisho Computer Systems Corp.
|| All Rights Reserved.
{define-proc {x-example-ref
                 title:String = {message Example},
                 href:Url, ...}:Visual
    let display:Graphic = {example-ref title = title, href, ...}
    {for-each-graphic
        {proc {g:Graphic}:void
            {type-switch g
             case g:TextEditPanel do
                || consume right click, so TreeControl ignores it
                {g.add-event-handler
                    {on e:PointerPress do
                        {if e.button == right-button then
                            {e.consume}}}}}},
        display}
    {return
        {text-width-display
            {expandable
                border-width = 2px,
                {bold {value title}},
                display}}}
}
|| *** calls the following ***
{define-proc public {example-ref
                        loc:Url,
                        title:#String = null,
                        base-url:Url = {get-base-url},
                        manifest:ComponentManifest =
                           {get-default-manifest},
                        package:OpenPackage =
                            {OpenPackage
                                CURL.IMPLICIT.APPLET,
                                CURL.IDE.DOCUMENTATION,
                                manifest = manifest},
                        ...
                    }:Graphic
    let result:any =
        {try
            {evaluate
                base-url = loc,
                package = package,
                {format "\{example title = %w,\n %s\}",
                    title,
                    {read-from loc}}}
         catch e:Exception do
            {paragraph
                Error in {bold {value loc}}:{br}
                {text color = "red", {value e}}}}
    {return {Frame result, ...}}
}

It is perfectly readable. When you see ‘…’ inside { } what you are seeing are rest arguments, or unnamed arguments for variable parameter procedure calls. And then again in the

{ return {Frame result, …} }

– these are not code elisions! The critical {example } macro is in the evaluate block. Dynamic language fans will note that the result is their preferred type: any.

And to learn to use this expand/collapse ‘live’ code environment/widget all I had to do was right-click on a folding code-editor page in the Curl Documentation Viewer which is itself Curl. I copied in the files to include for my applet and set a few imports in my ‘manifest.mcurl’ file. No CLASSPATH to look at, no question of which JARs are where. No JavaScript library required. As cool as Smalltalk, Strongtalk or the XOTcl IDE.

To see one in action, you will need the XML Document Model for Curl 5.0 from curl.com
Just install the RTE, then the IDE and then the XDM. Open your Documentation Viewer and search for ‘WSDK XML Document Model’ or just ‘build-xml

The proc identifies an anonymous procedure and we pass in what Groovy calls a ‘closure’ at on e:PointerPress do or what would likely be an inner class Listener in Java.

If you know something as cool using FLASH with ActionScript, post a snippet or a link to same.
Of course you could do this using AJAX with Prototype and Scriptaculous. But I got this page out in a matter of minutes. Oh yes, Sun says JavaFX is not about ‘throwing up pages’ …

Imagine that you are working on a problematic page. You drop in a gem like this and now you are displaying and experimenting with your code. Only Seaside for Smalltalk can rival this as far as I am aware but that requires some understanding of Smalltalk. I love Seaside, but I know of nothing that can beat this. Of course Rebol 3.0 is on the way …

As for snide remarks from Sun in their JavaFX promo, there are quick ways to throw up a web page… I like blocknote and there is the Meta/HyperCard Revolution product or even MS Word or FrontPage in a pinch…

The Curl IDE in the context of a web page versus Seaside ‘halos’

August 12th, 2007

Over at blogspot I have a post on inspecting objects ‘live’ in web pages.
What I neglect to mention there is what is really nice if you are used to using Mercury Interactive and that is the fact that inspectors allow you to flip some properties of an object ‘live’ in your web page.

Suppose you have an inspector open on a widget which occurs more than once on your page. With one click on the inspector’s toolbar you get a color-picklist. You can flip the color of the inspected widget’s background or border ‘live’ on the web page in your browser. Ah … that ListBox!

Curl does not use <FORM> elements in web pages; instead, Curl uses the GUI widgets familiar to anyone who has been building Rich applications in Tk, Smalltalk, Swing or most any other GUI framework.

Once you Ctrl-Right-Click on a Curl control on a web page you will see why I now rank the Curl IDE up there with Seaside for Smalltalk or XOTclIDE (the extended OTcl IDE.)

In the Curl web framework a CONTROLLER represents a joystick-type device and a ‘control’ such as a TreeControl is a CONTROL. No “let’s all pretend this is MVC because that is the OOP TLA” mantra. But with anonymous procedures and macros. As I said, COOL. Maybe not REST, but COOL enough with SOAP or XMLHttpRequest. As those of us with teens have had occasion to say, ‘Give it a rest, will ya?…’

PS Comes with built-in profiling, test coverage for QTP and even HTTP monitoring. A web content language from MIT with lambda functions that does not even look like LISP. Not bad. Readable code for literate web programming. Nothing clever embedded in HTML comments.

|| COOL
|| web2.0
|| comments

and

|COOL-tag
|| web2.0
|| documentation
COOL-tag|

Not a kluge and most have not a clue. Oh yes, MIT. CLU. What was her name?