Tuesday, May 26, 2009

moved ekkes-corner blog to wordpress

Last days I moved my blog "ekkes-corner" from Blogger to Wordpress. I was impressed how easy all my existing blog entries and comments are imported. Some are looking not exactly the same as before, but over all it worked great.

All my new blogs will now be there at Wordpress - hopefully the Feed of Planet Eclipse will be updated soon.

Eclipse 3.5 (Galileo) is coming - and its a good idea for you to become a Friend of Eclipse

Many new cool things in the area of PDE, Target Platforms, Runtime, Riena, Modeling (EMF, oAW) - I'll report about my experiences and give some tips and tricks in my upcoming blog posts.

stay tuned...

ekke

Monday, May 11, 2009

New Ways Around Generation Gap Pattern - VideoCast

To demonstrate the use of VetoRedirectStrategy in oAW workflows (see my last blog entry "New Ways Around Generation Gap Pattern") I created a videocast - movie.

After publishing my first videocasts I learned that there are sometimes problems to play them in different browsers. So I publish my screencasts in different formats - you can use what fits your environment.


Have fun.

ekke

Tuesday, May 5, 2009

New Ways Around Generation Gap Pattern

This blog dsescribes some new ways around "Generation Gap Pattern (John Vlissides)".

ModelDrivenSoftwareDevelopment (MDSD) - Best Practices

Some best practises are valid at all MDSD projects:

  • generated code should be clearly separated from manually written code
  • generated code should not checked into a VersionControlSystem (CVS, SVN, GiT)

Inside a MDSD (ModelDrivenSoftwareDevelopment) project there are different types of code (see also Heiko Behrens article)

Manuelly written code

Code never be generated, always manually written. This can be some base framework classes or code only used at some places not worth to generate like Utility- or Helper classes.

Generated unchanged code

Such code will be always generated and never changed manually. Classes will be re.generated at each run of the generator - existing files are overwritten or destroyed before.

Generated but editable code

This is code where its useful or ecpected that the generated code will be changed or extended. If files exist, they will not be overwritten - new files will be added and generated first time. (generate-once)

Generation Gap Pattern

The main problem with generated code is always how to combine or separate generated code and manually changed / extended code. That's the point where in most cases the Generation Gap Pattern will be used:

Generated classes will be generated into a directory which is cleared before generation. Subclasses will only generated first time into another directory where they can be changed.

In practise some problems happen - per ex. "Ghost Classes" after refactorings / renaming. Also you cannot differ between generated and changed Subclasses - so all will be checked into VersionControlSystem.

To make this more practicable, Heiko Behrens describes „Conditional Generation“ where generated and changed Classes are clearly separated. oAW Workflow can use a "Vetostrategy": Before generating an artifact it will be tested if there's already a changed artifact into another direcrtory - and if found no new generation happens.

This is described in detail in Heiko Behrens article „Generation Gap Pattern“. If you dont have read this article, please do now. I expect that you know the VetoStrategies described by Heiko !

Thanks to Heiko Behrens I got the information about oAW „VetoStrategy“ which was new for me - never read about it in the docs or forum. Now I was inspired to find some solutions for my project better then previous workarounds.

At first I must say, that I have some problems to use the „Generation Gap Pattern“ as generic pattern if generated code also has to be modified in MDSD projects. Working as softwarearchitect and designing an entity model (esp. in the domain of Enterprise Business Applications), I very carefully think about inheritance strategies / hierarchies. (esp. if all must be mapped from Hibernate or EclipseLink to a database)

A really simple inheritance:


If you follow the „Generation Gap Pattern (John Vlissides)“ :
Image from „Generation Gap Pattern“ (c) 1996 John Vlissides

... separating Classes into one generated (often abstract) Class and one additional (often first-time-generated) editable Subclass ...
use of generation Gap Pattern in many oAW projects

... then the inheritance - hierarchy becomes "dirty" from my point of view. In big projects suddenly hundreds of classes are "twice" - and the only reason is technically: because its a modeldriven project ?

I only want to use abstract / concrete classes or super- / subclasses if I need them from my use-cases or software architecture, but not because I'm using a generator - framework.

As always using a pattern you should ask: is it the right pattern or are there other ways to reach the goal ?

From my opinion: the "Generation Gap Pattern" helps in many cases, but not always. Heiko Behrens shows how the use of "VetoStrategies" in oAW workflows will help handling the files and folders, but its no solution to avoid getting many classes twice which bloats the architecture.

Protected Areas

So we again have to find an answer how to separate generated and manually written code without breaking the rules of best practises in MDSD projects.

There is another way: „ProtectedAreas“. STOP crying ;-) please read ahead - I try to use protected areas something different then normaly !

What are „Protected Areas“ ?

If there are some parts of the code where its allowed to modify or extend, then the Begin and the End are marked as special comments identified by an unique ID. Inside these protected areas the default code will be generated and the area will be marked as DISABLED, so if regenerating it will be overwritten.

If a developer modifies / extends the content af a protected region, then this region has to be ENABLED and the changes are protected after regeneration. Using „Protected Areas“ the structure and inheritance of your classes remain unchanged - exact the same as using it without a generator.

How are „Protected Areas“ normaly used ?


Whats the drawback ?

Now classes have protected areas, can be overwritten if regenerated but then they will be checked into VersionControlSystem - thats bad, because there are many classes without changes: only generated content. That breaks the rule "never check-in generated code".

Also you dont see which classes have changes and which are untouched after generation.

Protected Regions using VetoRedirectStrategie

Here's my solution

  • at start of generator-workflow clear „src-gen“ and „veto
  • generator scannes „src-gen-pr“ and caches ENABLED ProtectedAreas
  • „only-generated“ classes will be generated into „src-gen“, also classes with „ProtectedRegions“ without a veto
  • classes with ENABLED „ProtectedRegions“ are stored in „src-gen-pr
  • while generating the generator checks using "VetoStrategy" if a class is already in „src-gen-pr“. If found, then the generated output is redirected into „veto“ directory where the new generated class together with ENABLED ProtectedRegions (from cache) is written to
  • as last step of generation the files from „veto“ are compared with corresponding files from „src-gen-pr“. Only if they differ, the new ones will be copied into „src-gen-pr“. Now we are sure only really changed files will get a new modified flag and checked into VCS.

The Workflow


Generated-only and manually changed code now is clearly separated. Only changed artifacts will be commited into VCS and the Inheritance structure is unchanged.

Of course I have to watch, that a developer changing „Protected Regions“ doesnt forget to activate them (ENABLED) and to move the file into „src-gen-pr“ if not already there.
If you want to check if a developer ENABLED a protected region, but forgets to move into „src-gen-pr“ you simply can add a step at start of your workflow: scan „src-gen-pr“ for protected regions - if some enabled are found, stop workflow with warning.
If you want to check if a developer forgots to enable a protected region after making some changes, you can include something like a checksum into the region and write a component to test these before starting to generate.
All is possible you see - but its of course a matter of time: each extra step will slowdown generation performance.
(Tip: sometimes the Local History of Eclipse helps - but there's currently a bug: oAW generator overwrites the last Local History entry instead of inserting a new)

Inside the default code of a „ProtectedRegion“ I always insert a comment like:

Disabled Protected Region:

Enabled Protected Region:

Some Tech Infos HowTo implement a RedirectVetostrategie

tested using:
  • Eclipse 3.5M6
  • openArchitectureWare 4.3.1 (If you already use the plugins from Eclipse Modeling Project you have to change the namespace)
  • Apache Commons IO 1.4 (SpringSourceEnterpriseBundleRepository - (Eclipse Orbit only has version 1.3.2 from 2007)

Workflow Components

Workflow Component Directory Cleaner (oAW Component)
outlet.src.dir points to src-gen,
outlet.veto.pr.dir points to veto.

Workflow Component Outlet with Vetostrategy (Redirect of enabled ProtectedRegions)

This Outlet uses a new Vetostrategy - also the Outlet Class was extended
outlet.src.dir points to src-gen,
outlet.src.pr.dir points to src-gen-pr and
outlet.veto.pr.dir points to veto.

Workflow Component „fileReplacer“ (Replace files from src-gen-pr ?)

A new Workflow Component compares corresponding files in veto directory and src-gen-pr directory and replaces modified ones.

A short view inside the new Classes and Interfaces

Class OutletWithVetoRedirection (extends oAW Outlet)

Interface VetoRedirectStrategy (extends oAW VetoStrategy)
vetoRedirectSourcePath points to src-gen,
vetoRedirectOutputPath points to veto

Class CondGenVetoRedirectStrategy (implements VetoRedirectStrategy)

hasVeto always returns false zurück, because we dont give a veto like from other VetoStrategies described by Heiko Behrens - we only want to redirect the Ouput Path into veto Directory.

Classe ReplaceVetoRedirectedFiles (extends oAW AbstractWorkflowComponent2)

Using Apache Commons IO its very easy to compare file-content and to copy files from one directory to another.
outputFile represents a file from veto,
sourceFile represents a file from src-gen-pr

-------------------------------------------------------------------------------------
Important hint:
I was inspired to write this blog after reading the excellent article from Heiko Behrens: „Generation Gap Pattern“.

Heiko Behrens shows concrete solutions how to better handle „Generation Gap Pattern (John Vlissides)“ if using oAW (openArchitectureWare) Workflow und Xpand / XTend. This blog is not an alternate solution - only an extension !
-------------------------------------------------------------------------------------

Summary

From my point-of-view the use of „Protected Areas“ combined with „Conditional Generation“ can be very useful in some projects. Best Practises rules are not broken.

But as always: „Its Your Choice“ - it depends from project and use-cases what makes sense.

Heiko Behrens showed some strategies - if you add my ProtectedRegion strategy, I think you'll find the right for your project - or perhaps its the starting point to try it out.

Inside a big project there's no problem to use different strategies side-by-side.

Hope I gave you some new ideas.

ekke

Blog in german

oAW goes Eclipse Modeling

openArchitectureWare




During the last months oAW (openArchitectureWare) was integrated into Eclipse projects - the so-named oAW 5.0 will be in reality the first oAW Eclipse release as part from Eclipse Modeling Project inside the Galileo train:


Starting with Eclipse 3.5 M7 it would be great if many oAW user will test, if oAW 4.3.1 projects are running well using Plugins from Eclipse Modeling. (if not please report Bugzillas)

Perhaps someone will ask: why is there still an openArchitectureWare project, if all was moved to Eclipse into different projects from Eclipse Modeling ?

Eclipse Modeling contains uncount sub-projects (see also JAX session from Jan Köhnlein „Eclipse Modeling Overview“).

oAW is something like a distribution - a container of some sub-projects running well together - making it easier für users to find out out the right combination to build projects using oAW-like MDSD.

oAW is also a very active community providing much KnowHow and Support for model-driven development - look at the forums here.

There also exist some additional projects around oAW not moved to Eclipse - so try out the new Eclipse Modeling Workflow (MWE), Xpand (M2T) and Xtext (TMF) but stay tuned at openArchitectureWare.

ekke
blog in german

Thursday, April 30, 2009

OSGI Enterprise Applications: Monster Bundles from 3rdParty

The (OSGI) world could be so wonderful, all are brave OSGI citizens:

  • one JAR file == one Bundle
  • import-package used for common dependencies
  • (required-bundles if used only in the own namespace)
  • ...

If you have to develope OSGI Enterprise Business Applications, then in most cases you have to integrate 3rdParty bundles, - projects, -frameworks.

And then it can happen, that a 3rdParty project looks good on the very first view: some bundles, well structured, dependencies make sense, but..... why is this core bundle so big ?


Here you'll find the answer: „looking into 3rdParty OSGI bundles

Perhaps the Composite Bundles from upcoming OSGI R4.2 (here and here and Richard Halls Session at JAX09) can help to encapsulate such monster bundles ? I'll try and report....

ekke
blog in german

JAX09 - HowTo build an OSGI EJB3 Server - Slides online

Last week I was at JAX conference in Mainz - as always some great days. Most important for me are discussions with friends and networking.

On Friday at OSGI Experts Day I had a session and could give an overview of my OSGI EJB3 server:




Uploaded the slides, so you can watch them here:

  • SlideShare (without embedded Screencasts)
  • Vimeo (as HD Video inclusive Quicktime Screencasts)

Next days I'll produce some episodes for my VideoPodcasts at ekkes-corner-tv.org and publish the session with audio added and some more details.

ekke
blog in german

Wednesday, April 8, 2009

redView - Dynamic Views for Business Applications

This year at EclipseCon in Santa Clara I presented first time the new Open Source project "redView" - started from Florian Pirchner and me.


The session was presented without the usual "slides-to-read-while-speaker-speaks". I was inspired by the book "Zen and the Art of Presentation" to make another kind of presentation.

But if you present a session in Zen - style, you couldn't only publish your slides to people not hearing you live. A Zen - style - session is only the half of work - you also have to publish detailed technical informations in an extra document.

In this case - those details will be published soon at redview.org to download.

If you were not at EclipseCon or visited another slot and want to know what I have presented, you're not lost - you can watch a Video Podcast:

ekkes - corner - tv just started

As an addition to my blogs in english and german language now I also will publish regular an english Video Podcast at ekkes - corner - tv.org:


I'll talk about and make live-demos about:

  • Eclipse as IDE and Platform for RCP and Server
  • OSGI - Equinox
  • Eclipse PDE (OSGI Bundle Tooling)
  • Eclipse Riena (Remoting, UI)
  • EasyBeans (EJB3 OSGI Bundles)
  • Drools (Rules Engine, Business Process Flows)
  • redView (Riena EMF Dynamic Views)
  • open-erp-ware (OSGI - ERP - Enterprise Application)
  • Model-Driven Development (oAW - OpenArchitectureWare XPand, XTend, Xtext, Workflow)
  • and more...

If you want to subscribe my Video Podcast:

open iTunes Store, search for „ekkes-corner“ and subscribe. There are two different formats available: for iPod/iPhone and for Desktop/AppleTV).

If you don't use iTunes Store you can read it directly from my web site: ekkes-corner-tv.org or subscribe RSS Feed from there.

The first episode presents the redView Session from EclipseCon.

EclipseCon was as usual: very short nights - but also much fun to meet all the friends again and to learn much.

Next months will be very hard:

  • redView should be published beginning of may 2009
  • my OSGI - Equinox - Server should run under Galileo
  • my ERP Enterprise App should go live in summer 2009

Not to forget: this month is JAX 2009 in Mainz (Germany) where I speak at OSGI Experts Day

There will be some Blogs and Video Podcasts to reflect all this work... stay tuned...

ekke

Thursday, March 19, 2009

Using RCP Views to view UML Diagrams ?

Who doesn't know this:

You as Software Architect have listen to your business users requirements and designed such great UML diagrams - and now you present them proudly - but your business users don't understand what you designed. They couldn't imagine what all those dependencies, relations, inheritance, 0..1, 0..* mean.

What if you could generate by-magic RCP views directly from your UML model ?

...and your business users can understand what your diagrams mean and also see those little hidden secrets from properties like "length of a String" causing the RCP View to show a single line or multi-line text field ?

...or showing fields marked as index as required with yellow background ?

...or showing your Enumerations as SingleChoices or Combos ?

Utopia ?

No - this is the way to realize it:

use openArchitectureWare to generate from your UML Model Java Code, Configuration Files, EMF Models and more


use redView to auto-magically generate dynamic Views from your EMF Models
(Hint: the first 3 TabItems represent 0..1 or 1..1 associations, the last two TabItems contain a Table and represent 0..* or 1..* associations)

Curious ?

Then visit on Thursday at 2:30pm Room 206 Session



redView is a part of a complex enterprise solution - if you want to know more about my OSGI - Equinox - Riena - Easybeans Serverproject please visit JAX09 in Germany and book the OSGI ExpertsDay.

ekke
blog in german

Thursday, January 29, 2009

Books and Conferences for Eclipse Plug-in Developers

Here are my Top 3 of new published books I'm using in my daily work of developing Eclipse Plug-ins in a model-driven way...


  • OSGI Service Compendium
  • EMF - Eclipse Modeling Framework
  • eclipse Plug-Ins

... now I only have to wait for the announced books of RCP and OSGI/Equinox - developing ;-)

Yesterday I met Eric Clayberg and Dan Rubel in munich and received one copy of their new „eclipse Plug-ins“ book. Because I couldn't wait, I already had bought it two weeks ago. Now Florian Pirchner has luck, because he'll get this one - think he can use it for his work on redView (Riena EMF Dynamic View).

Also good news for UI developers using Riena Ridgets: the integration / code generation from SWTDesigner will be better in the near future, Eric told me.

         +


BTW: Who doesn't know: Riena is read-to-go for version 1.0. Congratulation !

We' ll also try to make it easy to insert dynamic SWT Components (generated from redView) into SWTDesigner.

Then you'll be able to design complex views using a comfortable GUI Designer and also include dynamic Components (like adress fields, ...) ... of course including databinding, Riena Markers and more.

If you're going to EclipseCon dont miss our session about redView:

And if you couldn't make it or you want to know something more  about the whole project - you can come to my session at JAX 09 / Eclipse Forum Europe 09 conference  -  OSGI Experts Day:

ekke

Wednesday, January 21, 2009

UserInterface in OSGI Enterprise Applications

Christmas time is over...


... and so its time to publish something. The last weeks ware filled with hard and intensive work to make my OSGI Enterprise Application run. Main work at the moment is the design of the Userinterface(GUI).

One part of the GUI - development I'll present at EclipseCon 2009, together with Florian, the Plug-In developer of redView. (redView = Riena - EMF - Dynamic Views)

The idea to create the redView project was born some months ago, as I was discussing with Florian the problems to design a GUI for a complex ERP Enterprise solution. Such an Enterprise Application with hundreds of Entities and high quality and comfort for the users to work with should be designed using a GUI Designer.


I decided to use SWTDesigner from Instantiations as GUI Designer tool - from my experiences a really great application.

An ERP Enterprise Application has many high specialized windows (views), but also hundreds of standard - views. Standard views are looking same and most parts of the views can be generated from the Entity - data model.


Because my ERP Application is model-driven (using openArchitectureWare) the first idea was to generate the Java code of those views. 

But if you generate Views there will be always usecases where the business user wants to change "only something". If you do this using SWTDesigner then the Java code will be changed and cannot be generated again. So its difficult to manage this, if the model changes, attributes were added or so. Of course its a good idea to generate the first version of the views to make it easier to start designing. 


My OSGI Enterprise Application already uses Eclipse Riena for Remote OSGI Services. Riena also has some nice things if you're devloping a GUI.

Riena makes the programming of UI easier and uses Ridgets (encapsulated SWT Widgets). You dont lose flexibility because if you need it, you can access the SWT widgets, too.  

Riena Ridgets also separate UI and Controller and make configuring Eclipse Databinding much easier. 

In Enterprise Businessapplications you always have to decide:

  • should this element be displayed ? (depends on Usecase or Data)
  • is this element required ? (the user must enter data)
  • is it a read-only element ?
  • are there validation rules for this field ? (Phonenumber, email, from-to value, date, ...)

Riena provides the concept of Marker and Validation making programming these things also much easier- and you're sure that it will always look the same in your whole application.

If the code was generated you'll get some informations for Markers and Validation already from the Entity model or Business-Process model.  (An attribute marked as Businesskey or Index should be a required field) So you'll get many defaults generated.

If you're using Riena there are some problems designing with SWTDesigner, because the  code generated from SWT Designer doesnt know the Riena - concept of splitting Controller und UI  - but hopefully in the future the integration will become better.

Riena also includes a complete UI concept with own LookAndFeel, navigation and nice designed perspectives, where a perspective can be a subapplication of the enterprise application. 

The Riena UI is clear, easy-to-use and doesn't confuse a business user with all the functionality of Eclipse RCP. But (for me) there's a downside of this concept: Riena always has only one View open at a fix position. There are many UseCases in an ERP Application where I need more then one View opened including Drag'n'Drop between the Views. I'll see if there will be ways in the future to combine this, because I would like to use some of the cool things Riena provides for  UI - development.

But all of this is no answer how to design Views of Enterprise Applications in model-driven frameworks: what can be generated without losing flexibility in design ?

So we're back at my discussions with Florian last autumn. Our vision:

Wouldn't it be great to have a GUI including all the comfort from Riena, dynamically created at runtime depending on an EMF Metamodel ?

... and these EMF models for each View itself are generated using openArchitectureWare from UML Entity- and Businessprocess - models  ?

... and having a graphical designer - editor, where a business user or - programmer can easyli change the generated Views ? (Drag and Drop to change the order / position of elements, add or change validation rules, add or change Riena Markers, Fonts, Colors,....)

... and wouldn't it be great to combine these changed EMF models with changes from UML models next time generating the Views again ?

This was a vision in october 2008 - now we're knowing that it works ( I already generated some hundred Views for the ERP project successfully) and we'll present it at EclipseCon 2009:

an Entity in UML class diagram (MagicDraw)

oAW Xtend creates EMF elements using UML model with JPA Persistence Profile

redView Designer with generated elements - the yellow marked entry field indicates a Riena Marker „required“

EMF Outline View with generated elements

The Properties View of one GUI element.

Its still some work to finish all aspects of databinding, I18N, Platform - independence (at the moment tested on OSX and Windows), and using Styles and Themes.




Hard weeks, short nights, bit it's fun to work with Florian and to make a vision reality.

Now these are the ways to design the GUI of my ERP Enterprise Application:

  • Standard Views will be generated using oAW as EMF models
  • redView creates dynamic Views from these EMF models
  • Spezial Views can be generated first times from oAW
  • Standard Views can be designed using redView Designer
  • Spezial Views will be designed using SWTDesigner
  • Riena Ridgets, Marker and Validation is used

The last years I was using EMF only indirectly and all my generation of code and artifacts using oAW was based on UML. No I reached the EMF world as so many others, too ;-)

The flexibility of EMF and the good integration into oAW is really great - it is so easy to work with UML and EMF together.

I'll report in detail about all different aspects of designing UI in Enterprise Applications from my point of view. Because its a complex story, I started a new blog series "UI in OSGI Enterprise Applications". Of course I'll also compare the pros and cons using some of the other great UI projects or how to combine them.

... stay tuned.

... the other blog series about Logging, Server, Declarative Services will also be continued - all belongs together.


ekke