BREAKING CHANGES: New Namespace Layout for Client-Side JavaScript Framework

tliebeck's picture

Hi all,

I've just committed a major update to Echo3 and Echo3 Extras that will affect all developers who are interacting with the client-side API (either writing JS apps or components). The API has been re-namespaced such that all objects of CoreJS are contained within a single namespace, "Core", all objects of Echo are contained within an "Echo" namespace, and Extras is contained within an "Extras" namespace.

Visit http://echo.nextapp.com/content/echo3/doc/beta2js/Echo3ClientAPI to see the new namespace / API specification.

Updating code should be fairly straightforward with the following search-replaces:

Search for: Replace with:
WebCore. Core.Web.
Core.Web.Environment Core.Web.Env
Core.Web.EventProcessor Core.Web.Event
EchoApp.generateUid Echo.Application.generateUid
EchoApp. Echo.
EchoAppRender. Echo.Sync.
EchoSerial. Echo.Serial.
EchoRender. Echo.Render.
EchoFreeClient. Echo.FreeClient.
EchoRemoteClient. Echo.RemoteClient.
EchoClient. Echo.Client.
ExtrasApp. Extras.
ExtrasSerial. Extras.Serial.
ExtrasRender.ComponentSync. Extras.Sync.
ExtrasRender. Extras.Sync.

I don't like doing stuff like this in the beta phase, but I believe the reorganization cleans things up quite a bit. Most API calls are now shorter (actually see a 1.5% drop in size of the YUI compressed version of the demo app, for example).

Changes are in Echo3 SVN 1170, Echo3 Extras SVN 457. They will be in beta2.

hi, would it be better if

hi,

would it be better if all "packages" was in lower case?

Like:

echo.sync.
echo.serial.

and then all classes in camel style, then: new echo.sync.Class();

It is like this in dojo, extjs, java.

and how about everything to be inside "echo" package, like: echo.core, echo.extras.

Just suggestions, I think it would be more organized but it can be just me.

oh, there is something else: considering Echo.Row and Echo.Column as examples, classes that have similar funcionaties should be in their own package too: echo.layout.Row and echo.layout.Column. It's good to have this package because another "layout"'s classes can be created like happened in extjs (there is at least 5 classes of custom layouts). But I can be wrong since I met echo3 today. So maybe those classes have nothing to do with extjs layout classes. If it is the case, sorry.

PS: sorry my english :)

tliebeck's picture

I was kind of torn on

I was kind of torn on whether namespaces should be lowercase or not. The problem I ran into that caused me to "ProperCase" name spaces is that there is somewhat of a blur between a namespace, class, and a static (non-instantiable) class in JavaScript.

The CoreJS library is actually not part of Echo, so it will always remain in its own top-level namespace. At present it's primary home is still the Echo SVN repository, but I hope to change this soon. Extras is a completely separate (albeit dependent) project from Echo. I'd like the rule for the "Echo" namespace to be that *only* Echo itself should use this namespace. I do want each individual project to only use ONE top level namespace though.

The namespaces are intentionally kept as short as possible. I'd love to have things more categorized, but its a burden when you're required to always type in the fully qualified name of an object.

Updated Client Demo App?

Where can I locate a copy of the client demo app which has these changes applied? That's the main reason I haven't updated yet. Is the demo app in SVN and if so what is the path?

tliebeck's picture

Demo app is not in SVN yet

Demo app is not in SVN yet (it'll get its own repo eventually). It's still not up-to-date. I need to get the last few changes in place on this very soon here (going to rename some files, fix a few bugs) and then release a beta2. Will have demo app updated at that point.

tliebeck's picture

As of Echo3 SVN 1224 and

As of Echo3 SVN 1224 and Echo3Extras SVN 499, the Render.*.js files have been renamed to Sync.*.js for consistency with their contained namespaces. Additionally, ApplicationRender.js has been renamed to Sync.js.

Two minor API changes have been added for consistency as well: EchoArc has been renamed Echo.Arc, and EchoBoot has been renamed Echo.Boot. These were simply missed in the first pass.

Core+Echo+Extras should now only be using three namespaces (Core, Echo, and Extras). Please report bugs/post here if you see anything different.