cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <>
Subject sharing microsoft experience
Date Thu, 22 Nov 2001 21:03:13 GMT
Despite the title that looks suspiciously close to marketing bullshit,
I'm still searching for the easiest way to come up with a "decent"
editor for semi-structured content.

I know I should be helping you guys coming up with the Cocoon final
release, but this work is for somebody that will hopefully pay me, so
you'll probably understand why my priorities shifted a little (besides,
you guys are doing a great job anyway!)

So, searching for the perfect editor, I was at friend of mine's place
and he was using HotMail over IE 6 to edit his email. Ok, not that fancy
so far. But he was using the "rich text email editor" build-in into the
browser window.

I jumped home, created a useless hotmail account (no way they are going
to lock me in their Passport stuff), downloaded the source of that
editor and recostructed the whole thing on my disk.

Note 1: it took me hours to do it!

Note 2: I'm probably illegally talking about it since the "mile-long"
click-wrap license probably says that now all my thoughts belong to
Microsoft Corp., so I'm probably discosing some of *their* ideas and
comments. I don't know and I don't care.

Ok, so, for the first time, I had access to the "source code" of some
Microsoft product. (IE 5.5 supports binary encoded javascript that is
supposed to obfuscate the code, but luckily they didn't use it for this)

Note: in order to reduce bandwidth (gosh, I hope so!) they removed all
the whitespace from the javascripts besides newlines.

Note: in order to reduce bandwidth (??? any other good reason?) they
removed all the ending ';' from the javascript lines! Yes, I'm serious!

Note: in order to reduce bandwitdh (or to obfuscate the code?) they
remove all the curly braces that aren't needed! I'm not joking, look at
it yourself!

[I strongly *HOPE* they transform their javascript source code like this
*only* for publishing and they keep a readable and commented version
inside, but if they not, I'm won't be that surprised after looking at
their code!]

Result: their code is *almost* already obfuscated. This is why it took
me hours to understand what was going on.

Ok, here's the feeling I got.

Remember the days when you wrote your first servlet and you ended up
having a bunch of stuff like:

	 + "<body>"
	 + myStuff
	 + "</body>"
	 + "</html>"

Do you remember how much you hated it?

Can you imagine going back to those days once you are used to the beauty
of SoC?


This hotmail rich text editing code is something like 1200 lines of
javascript (after pretty printing). Not that much after all.

Well, 40% of it is hardcoded println-style HTML.

Go figure.

No wonder their release cycles blow up and they can't keep up with their
software complexity. Guess why! Hopefully C# will help them gain some
elegance in software design, but for some people used to monumentary
hacks such as hungarian notation, I'm not sure even the best language


despite this huge amount of hardcoded HTML, the logic behind the design
of the inline-editing concept is a *very* nice one.

Ok, people, calm down: we are talking about HTML editing, not general
XML editing and not even something you can drive with a schema (you need
MSXML for that, as Xopus does, but I didn't touch that side yet).

But the nice part is that such XHTML editor is *pure*.

In the hotmail RTF editor there is an undocumented (well, "unused in
hotmail") feature that allows you to have access to the source view.

I was *delighted* (to say the least) to see something like this:

  <p>This is a paragraph <strong>and this is a bold string</strong></p>

I almost jumped across the ceiling!

IE inline editing is *semantic*! (well, it's as semantic as XHTML
allows, but it's already a big win!)

So, here's the idea:

 1) Connect the inline-editor with a few lines of javascript that copy
the nodes included in the editing section (normally a DIV with special
ID) in the FORM body, 

 2) Connect some botton on the screen to the POST action of the form
 3) direct the action to Cocoon, 
 4) use the StreamGenerator
 5) transform the semantic XHTML to your semantic markup
 6) write a transformer to save it into your favorite CMS
 7) style the resulting information
 8) send it back to the client

Voila'! the simplest and most widely available semi-structured editor
you can have right now! Without even having to install software on your
clients! (well, most of them)

See attachement for a working example (again, requires IE 5.5+) with a
bunch of neat functionalities (such as IE-like CSS buttons, draggable
toolbar with stickyness) I'm still missing the form-sending part so it
doesn't really do nothing useful. 

I'll work on the remaining part in the next few days.

Ah, I forgot: I hate scripting languages! I want strong typing!!!!
scripting is easy to do easy stuff, but it becomes a nightmare for doing
more complex stuff.

Besides, IE *sucks* at error reporting: it took me a hour to understand
they have a bug that indicates the error in the line *below* the actual
line and if you include multiple scripts, it doesn't even tell you
*which one* of those scripts!


Besides I'm so used to the elegance of component models that I can't
program without them anymore! And javascript is sooooooooo limited :(((

But it's a pretty cool toy :)

Anyway, I totally understand (now) wh the mozilla guys invented a bunch
of technologies around the simple scripting.

Microsoft did not (well they have their "HTML components" markup but it
sucks dry compared to XUL+XBL).

Who believes that IE has more future than Mozilla only because *today*
it owns almost the entire browser market is definately blind, or a
*very* bad programmer.

Enjoy the first fancy DHTML I ever wrote :)

If I can do such things with IE, I can't even think of what I can do
with the full source of the browser at hand :)

Mozilla, here I come! :)

[well, in the future, not IE is a lot easier and faster since it
contains the functionality I need]

Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<>                             Friedrich Nietzsche
View raw message