Grey Line

This weekend I read a blog by Ted Patrick and found very interesting phrase:”If you take a careful look at Catalyst it flips the % of design and development work within an app. Where development was 80% of an app, it is now 20% and Design/Interaction was 20% is now 80%”.

Sorry for taking it out of context, but I think it will be taken out of context or even becomes a mantra for new development process the same way UML 10 years ago was suppose to produce 80% of the application out of structured requirements. I am certain that this interpretation was not intention of Theodore Patrick or anyone at Adobe.

I would suggest that 80% - 20% separation has to be clarified as it might be used by some as Adobe’s recommendation of budget/time allocation and it could be problematic for the current state of the industry.

Less generalized statement IMHO would be this:
In order for applications to be successful in consumer / occasional user market you will need to increase your typical “functionality based” budget few times for usability, design and testing. You will also need to keep lid on features in order to achieve usability staying within budget constrains.

Applications targeting mobile devices and occasional users on conventional ones are definitely a growing trend that Flash platform is best positioned to take over. Enterprise and niche application will still be out of reach of UX due to budget / features constrains – so the following notes might not apply.

I agree that most of the current design work goes into packaging (opening page(s) and stylesheets) and does not affect the quality of the application. I would argue that cinematic experience is more important than design. For example, in the movie industry films based on beauty rather than the character have higher attrition rates and lower retention.

IMHO, there should be stronger distinction between visual design (how it looks) and “interaction” design (how it does things).

People will adapt to anything that is simple and easy to understand. Current UX wave is driven by people who have taste, which can be acquired over time… even by developers. Time is of essence here - developers just need the same tools and reasonable project deadlines as the rest of the team rather then cram their time toward the end of the project.

In my experience it takes less then 6 month for a developer moved from PC to MAC OSX to “forget” old way of doing things and acquire the same taste for simplicity the designers historically enjoy by using designers products. Adobe developers have long history of using non-Microsoft systems and it is definitely reflected in the way the build applications with or without designers.

At this point any serious Flex developer working on consumer-facing project must go through at least some training in Web Design to the extent that they can modify Photoshop, Illustrator or Flash files to annotate/fix a design flaw and communicate it properly to the designers. That implies to a large extent that 60-80% of the overall time is still in the development as developers extended their reach into modern UI. It also greatly reduces overall project time and mis-communications.

I certainly hope that Flash Catalyst will be bridging the gap for the rest, but expect mixed results if people would not expose themselves significantly to the other side of the fence. Finally, as client portion of RIA becomes simple and intuitive, more work needs to be done on the server to prepare and support such predictable and intuitive behavior.

I lived through few projects of complete picture perfect designs made upfront. Unfortunately, those static pictures are full of loopholes. Good developers are just as good as good designers in interactivity and much better with data models and overall process. In the end, negligible percentage of the picture-perfect upfront design is usable and could be counterproductive for the project lifecycle as compared to conventional wireframes as a common ground. Only from common understanding (the more visual the better, but not ONLY visual – you need to make sure it is also in words so you can ensure common understanding, provide comments and establish two-way process) you can start real team work on your next RIA project.

Sincerely,
Anatole Tartakovsky
Farata Systems

Comments

 

Grey Line

But do it after you got hired.

A custom component A (written in Flash) sends a custom event with parameters to a component B (written in Flex), and the latter needs to pass received event’s parameters to Flex  Application object. The code below just traverses through all parameters of the dynamic custom event and assigns them to the corresponding properties in the Application object.

private function passParamsToApp (event:MyGreatEvent):void{
// this code can be used in preloaders that need to load fast small Flash swc
// getDefByName syntax allow to avoid pre-linkage of the Application obj 
var anApp:Object = getDefinitionByName ("mx.core.Application").application;
 
for (var i:String in event) {
   try{
        anApp [i] = event [i];
   } catch (e:Error) {
      trace ("There is no parameter " + i +  "in " + anApp + " defined");
  }
}

The custom event is also defined not by the book (actually, it’s in our book) - it has no clone() function, no metadata tags, and no officially declared custom properties:

public dynamic class MyGreatEvent extends Event{
 
   public function MyGreatEvent(type:String, customerID:String, someOtherJunk:XML){
      super(type);
      this.customerID = customerID;
      this.someOtherJunk = someOtherJunk;
   }
}

You can read more about Flex apps using a single event here:
http://flexblog.faratasystems.com/?p=285

As you see, this code in the for loop works on the assumption that the Application object has setters or the public properties with names that match parameters of the event (customerID and someOtherJunk).

But even this requirement can be overcome if you’ll use dynamic application object as explained in Chapter 2 of our upcoming book “Enterprise Programming with Flex.” (Anatole, Victor, and myself have a high-priority task to submit the final two chapters to O’Reilly in two weeks).

If you’ll offer something like this during the Flex job interview answering the question,  “How to pass parameters from a custom component to Application object?”, you’ll get burned by object-oriented purists.  The kosher answer in the interview situation is a well prepared speach about the Mediator pattern as explained here http://flexblog.faratasystems.com/?p=246.

But if I’ll be running this interview, you are hired!

Comments

 

Grey Line

Information Week has published an interview with GM’s CIO discussing the impact of the bankruptcy on the two-billion-IT operations of this huge corporation .
After reading this article, I’m pretty sure that GM’s IT is doomed. The chances are slim that they will turn themselves into leaner and agile organization as it should be in 21st century.

The article reveals “In 2006, GM awarded about $7B (!) in IT contracts to EDS, Capgemini, Hewlett-Packard, IBM and others, and earmarked another $7 billion or so for additional contracts in following years. Szygenda has a history of demanding that outsourcers change their operational practices to fit GM’s needs. One example is their creation of global teams to work on GM accounts”.

Now let me explain how I read this interesting paragraph. These leeches , a.k.a. global consulting firms were charging $200p/h for mediocre consultants and were able to suck $7B worth of blood out of GM and are ready to continue enjoying the party. If you’ll tell me that I’m going over board with $200, let me explain how it might looked on paper – five inexpensive offshore resources at $40p/h each. Can you imagine, in India you can hire a project manager for only $40p/h! It’s like dream come true.

But let me ask you, my dear typical Fortune-500 CIO, “Why did you need that project manager in the first place?”
“Yakov, don’t act silly.  He’d manage a team of 4 developers for this job”
“Why did you need this team?”
“It’s required as per the approved architecture and the project plan provided by our consulting partners”
Sure, it started even before the project plan with dead souls from overseas (see http://yakovfain.javadevelopersjournal.com/dead_souls_from_overseas.htm )was carefully baked into it.

Most likely, it started when these nicely dressed salesmen showed up at GM armed (and dangerous) with beautifully prepared powerpoint presentations showing “where you are now” and “where you want to be in a year, two years, and even five years”. Yes, they knew all the answers. And here’s the road map that will bring you from point A to point B with the help of Global Leeches Ltd.
The visitors would continue, “If you’d hire American resources for the same job, it would cost you $15B, but we can deliver the same suite of products and services for mere $7B.”

Sounds like a good deal, and the orgy of the vampires begins.

The Information Week’s article states that GM awarded $7B in 2006, but you’ll never learn such classified information as how much of this amount was spent on the projects that failed.
Another hint that GM’s IT is doomed is the statement about creation of the global teams. The combination of two innocent words global and team gives me goose bumps.  I don’t believe in global teams.

I’m one of the partners running a small company, and we’ve learned our lesson and would never hire a global team. We cherry pick individuals, put them through THE SAME tough interviewing process as local candidates would go through. We manage individuals. This model works for us just fine.
During the last (tough) year, majority of our clients were not large corporations, but the small ones, and we found the explanation. Solutions that we offer are based on simple architectures that do not require bringing a bunch of consultants lead by a full time manager.   We give our customers an economical solution.

Interestingly enough, when we present our solutions to small companies running on a very limited budget, they are well received by these companies that must count their money. But if we’d present the same solution to a large IT shop, it would not fly. Why? Because individuals and small companies appreciate real costs, track record and simplicity as main artifacts of “real cost of ownership”. Large organizations are more concerned with imaginary artifacts of “savings”, “discounts” and “proven architecture” while keeping large outsourcing budget as it’s easily justifies their IT portion of “managing”.

People in the enterprise architectural committee will quickly “get the message” and will look for technical solutions that can be illustrated with some “serious” architectural diagrams that would help in proving… the need of having a full time architectural committee. But realistically that would inflate the efforts to the extent that would help these individuals in achieving their career objectives pleasing the C-level management at the same time.

The rest of the answers by Mr. Szygenda (GM’s CIO) just confirms that he’s not a leader that GM needs at these trying times. He quotes the statements of the CEO who believes this and that. We know were his believes brought the company. The CIO uses the words could and probably too often.

I see no hope there.

Yakov Fain

Comments (1)

 

Grey Line

Guys,

1. As a speaker of AJAXWorld conference (NYC June 22-23), I can invite
anyone as a guest for free (the guest won’t get free lunch or access
to iPhone conf though).

Enter discount code ajaxspeakerexpo at http://tinyurl.com/qtu4b8

My presentation is about occasionally connected applications with Adobe
AIR, Java and BlazeDS: http://ajaxworld.com/event/session/469

2. Preliminary topics for our Second Annual Enterprise Flex Symposium are published at http://www.eventbrite.com/event/355645746.

Regards,
Yakov

Comments (2)

 

Grey Line

This is great news. The most valuable new feature for enterprise developers are data-centric code generator and network monitor. Flash I’m glad that Adobe picks up the best ideas from third-party libraries and components and implements them in Flash Builder. It’s a win-win situation for the Flex community.

Flash Catalyst will become the main prototyping tool for all Flex UI designers. Need to analyze the generated code to form an opinion about its effect on the productivity of Flex developers.

Overall, I’m pleased with these releases. My writeup about them is here: http://flex.sys-con.com/node/982740.

Yakov Fain

Comments

 

Grey Line

Yesterday, my colleague and I received notifications from Adobe MAX organizers that started with words “We regret to inform you…we were forced to make difficult decisions, which topics would be of most interest to our attendees”.

The following three out of five submitted proposals were rejected:
1.    Flex Design Patterns that Make Sense
2.    Occasionally-Connected applications with AIR and  BlazeDS
3.    Partitioning Flex Enterprise Applications

At this time, we haven’t received the responses for two more submissions:

1. Starting new Enterprise Flex Project
2. Improving Performance in Flex applications

None of these presentations is about marketecture – just heavy duty technical stuff from people who are actually using Flex in the real-world projects.

Of course, MAX organizers had to make difficult decisions. Of course, they wanted to ensure that engineers from Adobe could share with the Flex crowd the latest solutions and techniques.  I don’t have a quarrel with that. But don’t they think that people who paid thousands of dollars to attend this interesting event were entitled to hear some advanced stuff from practitioners? Apparently not. Expect to see 100-level talks like “How to use Flex Builder debugger” or “FlexUnit Crash Course”.

I want to make myself clear – I’m not complaining. Adobe can run their shows the way they want. It was my fault - I made the wrong assumptions expecting to see a selection process similar to JavaOne, where plenty of non-Sun employees get a chance to have a shot based on the technical merits of their presentation proposals.

No biggies. Now I know that it’s Adobe’s show, and I won’t bother with paper submissions in the future.
What’s left? It’s elementary, Watson! We’ll keep running our small-scale seminars and symposiums for those who want to learn from our experience and share theirs.

Having said that, here’s the three upcoming events that we’ve scheduled:
1.    Second Annual Enterprise Flex Symposium, August 7, New York City: http://www.eventbrite.com/event/355645746 . We haven’t published session descriptions yet, but expect to see most of the rejected by MAX presentations and more. If you’d like to present at this technical  no-fluff  event, please send me an email at yfain at faratasystems.com

2.     Advanced Flex 2-day workshop in Toronto, Canada is scheduled for July 23—24. Details at http://www.eventbrite.com/event/353452185

3.    Advanced Flex 2-day workshop in London, UK is scheduled for September 24—25: http://www.eventbrite.com/event/355598605.

Besides these events, I’ll make a presentation on occasionally connected AIR applications at AJAXWorld in New York City on June 23 http://ajaxworld.com/event/session/469 , and on design patterns that make sense at CFUnited in Virginia on August 14: http://cfunited.com/2009/schedule.

I also try to do my best to attend 360flex conferences made by developers and for developers http://www.360flex.com/ .

Yours truly,
Yakov Fain

Comments (2)

 

Grey Line

This advanced Flex workshop has been very well received in New York City and Boston. The next destinations are Toronto (July) and London (September).  These are some of the topics covered during these two days of immersion into the Flex and AIR world:

- Data binding and MVC under the hood
- Custom component life cycle
- Selected Design Patterns in Flex
- What are the options in linking Flex libraries to minimize the size of your application?
- Minimizing the  download time of your Flex application (perceived and real)
-Pros and Cons of various methods of accessing the server tier

- Comparing LiveCycle Data Services and BlazeDS
- Basics of  creating custom communication protocol adapters for BlazeDS/LCDS
- Making Flex messaging shine
- Server side push to Flex Clients in BlazeDS
- Data Synchronization with LCDS and BlazeDS
- How to staff Flex projects
- Comparing MVC Architectural Flex Frameworks( Cairngorm, Mate, PureMVC)
- Overview of Clear Toolkit (Log4Fx, Fx2Ant, Clear Data Builder, DTO2Fx)
-Application builds and continuous integration
-Reverse RPC – a Java application server calls the Flex client
- Peer-to-peer remoting (a client calls a function on another client)
-Modularization of Flex applications with modules and sub-applications
- Flex Portals
- Occasionally Connected Applications with Adobe AIR BlazeDS
-Testing tools Flex applications
-Dealing with memory leaks in Flex applications
-Challenges of printing from Flash Player
-PDF generation on the client
-Open table discussion: real-world challenges and success stories of the workshop participants

FAQ

What’s the size of the class?
Under 20 people

Is this a hands-on class?
No. It’s not possible to cover all these topics during two days in a hands-on set up. It’s a mix of lectures, live demos and code reviews

Do you provide any materials for the attendees?
Yes, Each attendee receives the hard and soft copy of all slides. We also provide the source code of all examples used during this workshop

Is it even possible to cover all this material in two days?
You won’t become an expert in these topics, but at least will get a good grasp of important concepts that will save you tons of time and efforts while working on your project. Based on the feedback from people who attended these seminars in the past, each person finds some solutions he’s been looking for to apply in his project.

What are the prerequisites for attending this seminar?
Having a hands-on experience with Flex  is a must. Basic understanding of Java also helps.

Do you teach this seminar privately on-site?
Yes, we teach this seminar world-wide. Please send an email to yfain at faratasystems.com if you’d like to make arrangements.

Is there any other any other workshop that  has similar curriculum?
No

Yakov Fain

Comments

 

Grey Line

8:20AM.

Was reading today’s schedule at one of the posters at 360flex conference.
A guy nearby said, “Highly recommend the talk ‘Caching and Synchronization in Flex’”.
“Are you the speaker?”
“Yes”.
I’m in.

8:25AM.

360Flex. Tuesday morning
-Hey, Yakov!
-Hi, Christophe! I really enjoyed your talk yesterday on the new Flex/Spring integration. In general, I’m not into frameworks, but this time just using the parts of Spring like adding a security piece makes sense.
-That’s right, and it’s not intrusive at all. Just use the module that you need. Is your talk later today?
-No, it’s tomorrow. “Flex Design Patterns  that Make Sense”
-Is it controversial? Are you planning to pick up a fight?
-As usual :).  I’m not a politically correct person. :)

Yakov Fain

Comments

 

Grey Line

Adobe AIR is cool because

1. AIR allows you to perform all I/O operation with the file system on the user’s desktop.
2. AIR allows you to sign applications and version application.
3. AIR offers an updater to ensure proper upgrades of the applications on the user’s desktop
4. AIR comes with a local database SQLite to keep the data (in clear or encrypted mode) right on the user’s computer
5. AIR applications can monitor and report the status of the network connection
6. You can start and run AIR application even when there is not network connection available
7. AIR has better than Flex support of HTML – creating a custom Web Browser is easy

Adobe AIR is not cool because

1. AIR can’t make calls to user’s native operation system.
2. AIR can’t launch non-AIR applications on the desktop (except the default browser).
3. AIR can’t instantiate a DLL.
4. AIR can’t call an ActiveX component since AIR application are not running in a Web browser.
5. AIR can’t directly access ports (i.e. USB or serial) of the user’s computer.

Clear Toolkit is cool because

It includes an ActionScript component OfflineDataCollection that allows you to program local/remote data synchronization.

Open source Clear Toolkit framework is here: http://sourceforge.net/projects/cleartoolkit/

The source code of the OfflineDataCollection is here: http://tinyurl.com/p23do5

A demo recording of the sample occasionally-connected AIR application is here: http://flexblog.faratasystems.com/?p=394.

To see the demo in person, come to my talk at AjaxWorld in New York City in June.

Yakov Fain

Comments

 

Grey Line

Next week, we are running a two-day Flex seminar in Boston. This is one of a kind public event that’s not offered by anyone else. Here’s what makes this event special:

1.    It covers a carefully selected set of topics that are a must to know for anyone responsible of the success of an enterprise Flex project.

2.    The curriculum has been created by practitioners working on real-world Flex/Java enterprise project during the last 3.5 years.

3.    This seminar is delivered by top-notch Flex professionals, certified Adobe Flex instructors and book authors Yakov Fain and Dr. Victor Rasputnis.

4.    This is a small-size event and each of you will have a chance to discuss things that bother you in your current Flex project. We don’t promise and immediate solution, but you can count on getting an honest opinion of an expert in this field.

5.    If you already completed any other training or played with Flex on your own, this seminar is a good next step in your education.

6.    We usually teach this seminar for our private enterprise customers, and we are planning to teach it publicly only one more time this year.

7.    The format of the seminar is a mix of lectures, code reviews and demos. Each participant will receive all the presentation materials used during the seminar.

8.    Last time, Torbjörn Nodin flew to the US all the way from Sweden just to attend this event. This is what he wrote afterward:

If you are considering RIA - be there! If you are considering Silverlight - be there! If you are considering Flex - be there! Even if you have to fly 10h over sea - be there! I did, and it was worth it all.

This time we’ll have one attendee coming from Great Britain.

And all this for less than $600 - readers of this blog get $100 off the price by entering discount code crisisdiscount (for new registrations only).

You still have a couple of more days to decide and book your flight to Boston. For more details and registration visit this Web page: http://www.eventbrite.com/event/295389518 .

Comments

 

Grey Line

Here’s an excerpt from chapter 3 of our upcoming O’Reilly book “Enterprise Development with Flex”: http://tinyurl.com/qu5dac

The chapter uses components from the open source component library clear.swc, which is available at http://sourceforge.net/projects/cleartoolkit/ . Although this library is included in the Clear Toolkit, you can download just the clear.swc alone.

Comments

 

Grey Line

On Monday, Adobe announced Flash Lite 3 platform to be a part of new TV sets/cable boxes - coming mid 09. It can be big breakthrough - even revolution - for the consumers. Or, without enough independent players, it can just be a neat way for cable providers to minimize the cost of targeted advertisement/services at the cost of upgrade of set-top boxes - most of them are being replaced this year anyway.

Giving programmable environment to the TV will be as freeing and devastating as Internet publishing for the traditional paper one. Traditional TV is best described by George in early Seinfield : “People will watch the show about nothing because it is on TV”. New environment can completely change not only HOW we receive the entertainment but WHAT and WHEN and HOW MUCH we will watch. Here is how it it works for me.
(Disclaimer: I have not been Cable TV subscriber for the last 8 years - after all I have kid at home. I watch movies that I choose, listen to music libraries collected for over 20 years, and share photos with my friends going back to black and white film. My base entertainment system is built around Macs network with every possible audio and video component not to mention musical instruments).

So last weekend I went to my brother birthday and gave him his first Mac Mini as a present. However, I did not plug it into his office monitor. Instead, it went straight into FIOS connection and HDTV unit. It had bluetooth Logitech DiNovo Edge keyboard and WII remote for mouse (kids preferred to use iPod). Most importantly, it had archive of family resources and was pre configured to securely access my “shared” libraries and gave me access to his “shared” ones. Plus instant video communications, screen sharing and VM remoting. For advanced uses, grid computing and documents backup.

The result was very enthusiastic from mostly skeptic (burned by Vista/Media Center fiasco) audience. Seeing that small box actually working caused quite a stir. I am pretty much set with birthday wish list for the next year. The simple fact that I can share my media and have “family” network and broadcasting, play human games like chess/cards/backgammon while seeing/talking to the opponent has great value to me - with friends and family all over the globe.

There is one small problem - the price for average family. The modern unit with backup drive and all extras costs ~$900. Flash on set-top allows for $0 cost (Ok, $200-300 for decent wireless keyboard and mouse and terabyte storage) while delivering most of the functionality of the above unit. Giving top boxes with HDTV ability to replace computers and TV programming can be a tipping point for the new media and relationship software.

Recently, just about 50% of Americans said that TV is “necessity” - more then 15% drop from 10 years ago. Most of the drop is accounted by the fact that younger generation is getting their entertainment via different (computer based) sources. As growth in facebook and myspace population is currently fueled by people around retirement age, HDTV based living room offers much more comfortable environment for mainstream adoption

I do not really care for twitter from anyone - especially paid editors to bombard me with clever sales pitches of 140 characters or less. If they have some thoughts to share, lets keep it real - 300 words at least, I would rather read or better yet listen to podcast/youtube from the people I trust. Trust is the key here. Once there is enough alternative information, the whole media structure is going to change. Advertisement as we know it will not work if people have alternative and more trusted source of information. In the end who do you trust - Amazon reviews or magazine editors dependent on the advertisement of the products they review?

Internet has not fulfilled so many predictions of the past millennium - like destroying the malls and making home shopping personalized and fun experience - but it will happen soon enough with the current economy. With so many people becoming disposed by Wall Street and Madison Ave the Silicon Alley gets all necessary talent and technology. It is going to be fun year, with more startups getting into RIA and streaming technologies - and I am looking forward with playing with new ideas and approaches to make programming more humane experience.

Sincerely,
Anatole Tartakovsky

Comments

 

Grey Line

Today we’ve finally submitted chapter 6 of the book on Enterprise development with Flex to O’Reilly. This one was about advanced techniques of using BlaseDS in communications between Flex and Java.  At this point you’d expect something like, “It’s coming out nicely”.   Sorry guys, I’m not a modest person. But I’m honest.

Here me out: this chapter 6 (66 pages) on advanced  techniques of Flex/Java communications using open source BlazeDS is a gem. This chapter alone is worth buying the book.  Server side push over AMF, reverse side RPC, automatic data synchronization…

I have the best co-authors. Ever. They’re just amazing.  Yes, we fight with each other. We don’t agree. We are not politically correct. We use the f-word when discuss enterprise architecture. We want to find the best possible solution for our customers. We publish thought provoking articles (some people call them controversial, but they are freaking wrong).  But guess what, we’ve been there.  And I’m not talking about sales presentations trying to convince you that Flex/Java does your body good.    “Take a look… it’s just 20 lines of code and we populated the data grid with XML coming from the server”. It’s so sweet….

I’m talking about the real stuff that Wall Street is dealing with day in and day out.  OK. Forget about Wall Street. They are still out of style. Let’s talk about the calls like this one, “We are going live in two months. Can you please take a look at our application it doesn’t perform that great.”

Oh, really….It doesn’t perform well? Don’t kid yourself. It’s dead in the water. I know, I know. You’ve outsourced the development. It seemed so easy to drag and drop Flex components… You didn’t get a chance to schedule stress tests yet? How many? Ten thousand users will play online roulette…? We’ll do our best.

I don’t know why O’Reilly decided  to sell this book for stinking fifty bucks.  We don’t have a say in pricing. But it should cost  a lot more than that.
Sorry, I’m not a modest person, but at least I’m honest.

Yakov

Comments

 

Grey Line

Upcoming release of the ClearDataBuilder supports AUTOINCREMENTed property in the DataCollection items populated from databases based on autogenerated values like MSSqlServer/ Sybase identity, or Oracle’s sequence, and so forth. All you need to do is add identity parameter to the CDB annotation

    /**
    * @daoflex:sql
    *  sql=select * from employee
    *  transferType=EmployeeDTO[]
    *  keyColumns=id
    *  identity=id
    *  updateTable=employee
    */
 
    public abstract List getEmployees();

and allow server changes to reflect back on the DataCollection:

dataCollection.roundTripSync = true;



Sample Use Case

Imagine a MSSqlServer table “employee”, with IDENTITY column named “id”. Here is the abstract Java class you would need to write:

package com.farata.test;
import java.util.List;
/**
 * @daoflex:webservice
 *   pool=jdbc/test
 */
public abstract class Employee
{
		/**
		* @daoflex:sql
		*  sql=select * from employee
		*  transferType=EmployeeDTO[]
		*  keyColumns=id
		*  identity=id
		*  updateTable=employee
		*/
 
		public abstract List getEmployees();
}

A Clean CDB build, as usual, will generate concrete implementation of the Assembler, already registered for Flex remoting, ActionScript DTO classes matching the Java counterparties and so forth.

Importantly, the specifics of the identity annotation will force CDB to enquire the value of the autogenerated id column along with the execution of the executeUpdate() and send the modified record back to the Flex client.


Two-Way Syncronization: DataCollection - BlazeDS Assembler

You have to allow the echo of the server-side changes back to the client. You have two options.

  • dataCollection.roundTripSync=true; - to allow Flex process the immediate result of “your own” dataCollection.sync() call
  • dataCollection.autoSyncEnabled=true; - to allow Flex consume server-born asyncronous messages with changes inflicted by other clients. This option requires design-time autoSyncEnabled=true CDB annotation as well.

    Here is the explanation. During the sync() operation changes originated in the DataCollection are remoted to method(s) of a server Assembler as Array of com.farata.remoting.ChangeObject elements. All of these methods are also returning the Array of changes, including, if any, changes originated by the server. The value of the roundTripSync determines whether these changes effect DataCollection when the synchronization is complete. Default value is false


    Pluggable Identity Factory

    No two databases are born equal. The default setting of the CDB is to handle identity compliant with MSSqlServer, i.e. to use SELECT SCOPE_IDENTITY() as the cleanest possible computation of the identity. If you are running Sybase, you would have to modify the default daoflex.identity.factory in the daoflex-build/daoflex-build-custom.properties:

    daoflex.identity.factory=com.farata.daoflex.SybaseIdentityFactory

    It gets worse if you are an Oracle sequence guy. Plugging a foo.bar.OracleIdentityFactory class that has to implement com.farata.daoflex.IIdentityFactory interface is not any different from the Sybase, but CDB does not know upfront which sequence to use. So roll up your sleeves and create something like following:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    
    package foo.bar;
     
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.util.Map;
     
    import com.farata.daoflex.DAOException;
    import com.farata.daoflex.IIdentityFactory;
     
    public class OracleIdentityFactory implements IIdentityFactory {
    	public long getIdentity(Map<String, Object> properties) {
    		long identity = 0;
    		PreparedStatement stmt = null;
    		ResultSet rs = null;
    		try {
     
    			Connection conn = (Connection) properties.get(CONNECTION);
    			String table = (String) properties.get(TABLE);
    			String sequenceName="UNKNOWN_SEQUENCE";  
    			// Your custom logic to determine the sequence give the table goes here		
    			if (table==table) 
    			     sequenceName = "MY_SEQUENCE";			
    			stmt = conn.prepareStatement("SELECT " + sequenceName + ".NEXTVAL AS identity FROM DUAL");
    			rs = stmt.executeQuery();
    			while( rs.next() ) {
    				identity = rs.getLong("identity");
    			}
    			return identity;
    		} catch (Throwable te) {
    			te.printStackTrace();
    			throw new DAOException("Failed creating identity", te);
    		}
    		finally {
    			try {rs.close(); rs = null;} catch (Exception e){}
    			try {stmt.close(); stmt = null;} catch (Exception e){}
    		}
    	}
    }

    Victor Rasputnis

  • Comments

     

    Grey Line

    We’ll be a two day training workshop “Flex for Architects” that will take place in Boston, MA on May 21-22, 2009.

    During registration at http://www.eventbrite.com/event/295389518 , enter the discount code flex100 to get $100 of the tuition.

    If you are about to start new Java Enterprise project, attending this workshop will definitely save time and money.

    Comments

     

    Grey Line

    I’ll be in Ukraine on a private visit. Microsoft and Sun Microsystems made arrangements, and I’ll be presenting on their joint meeting reviewing technologies for RIA development (AJAX, Flex, Silverlight, JavaFX). This event will take place on May 4, 2009 in the offices of Microsoft Ukraine. My special thanks to Aleksandr Oreshnikov from Microsoft Ukraine for making it happen.

    If you live in the area, you can register for the event at http://www.developers.org.ua

    It’s going to be an interesting experience for me as I’ll need to present in Russian - most likely this talk will be heavily sprinkled with English terms, but  I’m sure Ukrainian developers will forgive me for this.

    Yakov Fain

    Comments

     

    Grey Line

    Is your RIA fast? I mean not when your are running it locally on your PC that has the Browser, Web server and the database installed, but when it’s out in the wild where people in the USA and Europe “enjoy” DSL speed of 512Kbps. The countries like India or Russia  use the term “broad band” if the network that can deliver 128Kbps.

    After all optimizations and modularization your newborn Flex RIA weighs 1MB, plus a number of libraries that may be lazy loaded after the user starts working with your application. Last year it was acceptable. Today, I think we can do better.

    Besides fine tuning of each and every loadable module that will improve actual performance of your application, there’s something that’s known as perceived performance.  The speed of loading of the home page of your application is crucial in forming the user’s opinion about performance of your application.

    If the home page won’t show up within 20 seconds, a typical user will say that performance sucks.

    Adobe Flex is a great tool, but Flex SDK is heavy. Even though you can link Flex SDK to your SWF as an RSL hoping that the user already have it cached locally, there’s always this first time when the SDK has to arrive to the client.

    So what’s the reasonable size of the home page of an RIA? IMO, it should weigh less than 200Kb. Is it possible with Flex SDK? I doubt it unless you are in business of selling Hello World applications.   In the past, we were trying to improve user perception by introducing pure Flash/AS splash or logon screens on the preinitialize event, but now I believe that we should take more radical architecture approach – create an entire home page in Flash without using Flex SDK API.   Then the Loader should be able to load SWF/SWC files created in Flex and Flash/Flex code can communicate via events.

    Development of a home page in pure ActionScript will take a lot more time than in Flex, but isn’t making the users happier the ultimate goal of any RIA?

    Yakov Fain

    Comments (2)

     

    Grey Line

    Upcoming release of the ClearDataBuilder supports deep synchronization of hierarchical DataCollections with the Server, so that if an item of the collection contains child collections and so on, the entire tree of changes, if any, gets synchronized with the Java back end in one transaction:

    orders.sync(true); // Deep sync of the DataCollection and all nested children



    Sample Use Case

    Listing 9 presents two SQL tables Orders and OrderItems. Sample application enables end user to navigate from order to order, editing the master information (order) as well as details (order items). All interactive changes are accumulated in Flex - until button “Commit” is clicked. That’s exactly when deep sync happens - in one transaction, i.e. all or nothing, “commit” of all changes or complete “rollback”:

    Snapshot of the Orders-OrderItems application
    Figure 1. Order-OrderItems application snapshot


    Client Data Persistance

    Two DataCollections - OrderCollection, Listing 2 and OrderItemCollection, Listing 3 - assist in persisting the data on the client; they remote to the methods of the Java class OrderAssembler generated by the ClearDataBuilder given SQL-annotated abstract class Order.java, Listing 8. Each item of the OrderCollection carries orderItems referring to the child collection of line items of this order. At the application level, Listing 1 below, we expose only the master collection orders, which holds the entire hierarchy:

    <?xml version="1.0" encoding="UTF-8"?>
    <!--OrderEntryDemo.mxml -->
    <mx:Application  
    	xmlns:mx="http://www.adobe.com/2006/mxml" 
    	xmlns="*" xmlns:collections="collections.*">
    	<collections:OrderCollection id="orders"/>
    	<mx:ControlBar>
    		<mx:Button label="Fill"  click="selectedOrder=null;orders.fill()"  />
    		<mx:Button label="Commit"  click="orders.sync(true)" 
    			enabled="{orders.commitRequired}" />		
    	</mx:ControlBar>
    	<mx:VDividedBox  >
    		<OrdersPanel id="master" orders="{orders}" 
    			orderSelectionChange="selectedOrder = event.order"
    		/>
    		<OrderItemsPanel id="detail" width="100%"	
    			selectedOrder="{selectedOrder}"
    		/>
    	</mx:VDividedBox>
    	<mx:Script>
    		<![CDATA[
    			import com.farata.test.dto.OrderDTO;
    			[Bindable] private var selectedOrder:OrderDTO;
    		]]>
    	</mx:Script>
    </mx:Application>



    Hierarchical DTO Items

    Not that you would not have to write any code. For one, you would have to make sure that your DTOs implements com.farata.collections.dto.IHierarchicalDTO interface, i.e. “get” accessor of childCollections. One way to do it is via helper class com.farata.collections.dto.HierarchicalDTOAdapter. Please note OrderDTO in the snippet below extends the similarly named class prefixed with the “_” symbol. This is how, by default, CDB names a pair of generated ActionScript DTOs: the class with the “_” gets regenerated by CDB on every “Clean” of the project, while the extending class is preserving manual edits. Also, do notice how child collection orderItems - for each item - gets filled asynchronously, on order_id setter:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    package com.farata.test.dto{
    import collections.OrderItemCollection;
    import com.farata.collections.dto.HierarchicalDTOAdapter;
    import com.farata.collections.dto.IHierarchicalDTO;
     
    [RemoteClass(alias="com.farata.test.dto.OrderDTO")]
    public class OrderDTO extends _OrderDTO implements IHierarchicalDTO{
    [Transient] [Bindable] public var orderItems:OrderItemCollection;
    [Transient] public var adapter:HierarchicalDTOAdapter;
     
    public function OrderDTO() {
        super();
        adapter = new HierarchicalDTOAdapter(this);
        orderItems = new OrderItemCollection();
        adapter.addCollection(orderItems);
    }
     
    public function get childCollections():Array {
        return adapter.childCollections;
    }
     
    public override function set order_id(orderId:String):void {
        if (orderId !== super.order_id) {
             super.order_id = orderId;			
             orderItems.fill(order_id);	
        }			
    } 
    }//OrderDTO
    }

    Browse Listings 1-8: except “view”-Panel components there is no other code you would need to write. As long a you start with the SQL-annotated abstract Java source everything else gets code generated by the CDB.


    What if you use CDB with the existing DAO, i.e. IJavaDAO?

    You are not confined to SQL-annotations to use the fill() and sync(), of course. CDB allows your DataCollections to remote to any Java class implementing com.farata.daoflex.IJavaDAO interface (see CDB documentation for more details):

    package com.farata.daoflex;
    import java.util.List;
    import flex.data.ChangeObject;
     
    public interface IJavaDAO {
        List fill();
        List<ChangeObject> sync(List<ChangeObject> items);
    }

    In addition to IJavaDAO, participation in the deep sync requires your Java class to implement IBatchTransactionServiceSupport. Methods of this interface allow to synchronize changes accumulated by the DataCollection in three independent steps: all deletes, all updates and all inserts:

    package com.farata.daoflex;
    import java.util.List;
    import flex.data.ChangeObject;
     
    public interface IBatchServiceTransactionSupport  {
        List<ChangeObject> deleteItems(List<ChangeObject> items);
        List<ChangeObject> updateItems(List<ChangeObject> items);
        List<ChangeObject> insertItems(List<ChangeObject> items);
    }



    BatchService

    Splitting of monolythic sync() into three steps is required to support the referential integrity of data: children have to be deleted prior to parents and parents need to be inserted prior to children. And yet we can not addord three remoting calls instead of one (sync()), six calls altogether in our Orders-OrderItems scenario, because server-side transaction can not be spawned across several remoting calls.

    That’s where BatchService class from clear.swc comes in play. It refers to sequence of several remote method calls-to-do as a “batch”, or, simply array of BatchMember elements: destination name, method name, array of arguments. Instead of multiple remote calls it sends the “batch” as argument of one remote call - to Java class com.farata.remoting.BatchGateway (daoflex-runtime.jar). In turn, BatchGateway’s method execute(List<BatchMember>) invokes the required remote calls sequentially, wrapping the entire sequence in the JTA begin/commit/rollback.

    Snapshot of the Orders-OrderItems application

    Here is a snippet illustrating the work of the BatchService:

      var bs: com.farata.remoting.BatchService;
      .  .  .
      bs = new BatchService();
      bs.addEventListener(FaultEvent.FAULT, onFault);
      bs.registerCollection(orders, 0); //0 - default (top) priority, parent
      bs.registerCollection(orderItems,1); //1 - priority, child of "0"
      .  .  .
      var batch:Array = bs.batchRegisteredCollections();
      bs.send(batch);

    As you can see, BatchService batch is not confined to DataCollections: you can batch for synchronical server-side execution any sequence of remote calls. While BatchService has been around since 2006. the dataCollection.sync(true) further reduces the amount of code required to transactionally update associated collections. Users of SQL-based branch of the CDB benefit from automatic generation of the required Java functions. Otherwise, your Java DAO has to implement IBatchTransactionServiceSupport.

    package collections {
    import com.farata.collections.DataCollection;
     
    public class OrderCollection extends DataCollection {
        public function OrderCollection(source:Array=null) {
            super(source);
            destination="com.farata.test.Order";
            method="getOrders";
        }
    }
    }

    package collections {
    import com.farata.collections.DataCollection;
     
    public class OrderItemCollection extends DataCollection {
     
       public function OrderItemCollection(source:Array=null) {
            super(source);
            destination="com.farata.test.Order";
            method="getOrderItems";
       }
    }
    }

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- OrdersPanel.mxml -->
    <mx:Panel title="Orders" 
    	xmlns:mx="http://www.adobe.com/2006/mxml" >
     
        <mx:Metadata> 
            [Event(name="orderSelectionChange", type="events.OrderEvent")] 
        </mx:Metadata> 
     
    	<mx:DataGrid id="dg" dataProvider="{orders}" editable="true"  change="onChange()" height="100%" >
    		<mx:columns>
    			<mx:DataGridColumn dataField="order_id" headerText="Order Id" />
    			<mx:DataGridColumn dataField="customer_first_name" headerText="First Name" />
    			<mx:DataGridColumn dataField="customer_last_name" headerText="Last Name" />
    			<mx:DataGridColumn dataField="order_date" headerText="Order Date"  itemEditor="mx.controls.DateField" editorDataField="selectedDate"/>
    		</mx:columns>
    	</mx:DataGrid>
    	<mx:ControlBar width="100%">
    		<mx:Button label="Remove" click="onRemove(dg.selectedIndex)" enabled="{dg.selectedIndex != -1}"/>
    		<mx:Button label="Add" click="onAdd(Math.max(0,dg.selectedIndex+1)); "/>
    		<mx:Label text="Deleted: {orders.deletedCount}"/>
    		<mx:Label text="Modified: {orders.modifiedCount}"/>
    	</mx:ControlBar>
    	<mx:Script>
    	<![CDATA[
    	import events.OrderEvent;
    	import com.farata.test.dto.OrderDTO;
    	import com.farata.collections.DataCollection;
     
    	[Bindable] 	public var orders:DataCollection;
     
    	private function onAdd(position:int):void	{
    		var item:OrderDTO = new OrderDTO();
    		item.order_id = "###" + String(orders.length + 1);	
    		item.order_date = new Date();
     
    		orders.addItemAt(item, position);
    		dg.selectedIndex = position;
    		onChange();
    	}