Archive for June, 2007

Grey Line

I’m sitting at the airport trying to send a couple of final emails. My plane to Europe leaves in a couple of minutes. I’m on my broad-you’re-gotta-be-kidding-me-band Internet connection which is slow as hell. I need to send an email to my son who is in the sleepaway camp now. I do not remember the camp’s email. After two minutes of waiting, about 10% of this camp’s RIA is displayed on my screen. I realize that most of the RIA will have really hard times is they won’t be done properly.
Rule number one: design the main screen of your application with some vital information to be as light-weight as possible. We’ve been experimenting with Flex loaders and can create an application that start with the first screen that is as light as 20-30K. Later on it loads and displays the rest of the modules. If you won’t properly partition your RIA, it’s going to be doomed.
Yakov Fain

Comments

 

Grey Line

Enterprise (especially financial) applications are different from the Web ones. The formers are distributed beasts sprawling across multiple servers/systems to provide real-time, rich, multi-format data. Here you have two key words – distributed and data. Distributed means unpredictable response time. That is a showstopper for conventional RPC methodology – you need to consider messaging. Also, it means that the client is a part of distributed chain – not all the Web restrictions are applicable, but QoS (Quality of Service), reliability and performance are part of the design.The data means that it comes in variety of formats that might be foreign to the Web server platform or client – some massaging is required.What the developers need is something to absolve them from all the issues of Internet communications and Server infrastructure. Something that works like RemoteObject but is scalable, support server push, is reliable, provides automatic QoS, reconnection of the transport, has better performance then regular RPC. On the logical level, it should deliver results in strongly typed ActionScript objects and should be accomplishable with a couple of lines of the application code. This is just a tip of the iceberg of what an actual enterprise bus communication needs, but it should be good enough for the introduction of the concept.

The implementation shown below is based on FDS 2.0.1. I might have separate entry on implementation with MidnightCoders product or openAMF/Tomcat with non-blocking IO Connector later this Summer.

Step 1. Teach Messaging to understand RPC calls:

This code is a slight variation of the BatchGateway AMF “batch handler” from the book. Optimization is removed for brevity. You create new descendent of RTMPEndpoint class that would watch for message coming through RTMP channel to be “RemoteCall” :

private Object processCall(String destinationName, String methodName, List parameters) throws IllegalAccessException, IllegalArgumentException, Throwable { Object result = null;

initRemoting();

RemotingDestination remotingDestination = (RemotingDestination)srv.getDestinationByName(destinationName);

FactoryInstance factoryInstance = remotingDestination.getFactoryInstance();

Object instance = factoryInstance.lookup();

MethodMatcher methodMatcher = remotingDestination.getMethodMatcher();

Method method = methodMatcher.getMethod(instance.getClass(), methodName, parameters);

try {

result = method.invoke(instance, parameters.toArray());

}finally {

factoryInstance.operationComplete(instance);

}

return result;

}

public Message serviceMessage(Message message) {

if (message is AsyncMessage and message.body is RemoteCall)

RemoteCall bm = (RemoteCall)((AsyncMessage)message).getBody();

try {

Object o = processCall(bm.destinationName, bm.methodName, bm.parameters);

AsyncMessage am = asyncMessage(message);

am.setClientId(/*you need to pass rtmp consumer id here – will add later*/ “1″);

am.setBody(o);

rtmpServer.push(am, am.getClientId() ); }catch(Exception e) {…}else return super.serviceMessage(message);}private AsyncMessage asyncMessage(Message message) { AsyncMessage am = new AsyncMessage();

am.setClientId(message.getClientId());

am.setCorrelationId(message.getMessageId());

am.setMessageId(UUIDUtils.createUUID(false));

am.setDestination(message.getDestination());

return a;

} Now register new RTMPEndpoint in services-config.xml and you can execute POJO calls over RTMP.

Now register new RTMPEndpoint in services-config.xml and you can execute POJO calls over RTMP.

Step 2. Call to the server is implemented with single API in descendant of Producer:

public static function call(rc:RemoteCall, r:Responder = null, noneOneMany:String = “none”) : AsyncToken {

Messsage m = new AsyncMessage(rc);

var t : AsyncToken = new AsyncToken(m);

ConsumerForRPC.calls[m.messageId] = t;

send(m);

return t;

}

Step 3. On the client side, establish Consumer receiving point. You will need just descendent of Consumer object to be connected to the same destiantion so you can start receiving the messages. You will also need to provide Producer/Consumer association to the RTMPEndpoint (see commets in the code) so the responses are sent to the appropriate client.

Here is a piece of code in the consumer that allows you to do RPC from the server to the client:

private static function processMessage(message:IMessage) : void {

if (message.body is RemoteCall) {

var rc : RemoteCall = message.body as RemoteCall;

var obj : Object = destinations[bm.destinationName]; // you register live objects as targets for RPC, factories/safety missing for brevity obj[bm.methodName].apply(obj, [bm.parameters.source]);

}

else {

// standard processing – the data is most likely result from RPC call – see if it is and call the responders:

var corId : String = (message as AsyncMessage).correlationId; var t : AsyncToken = calls[ corId ];

if (t == null) return ;// regular push via messaging

for (var i:int = 0; i < t.responders.length; i++) {

var r:Responder = t.responders[ i ]; r.result(

new ResultEvent(“result”, false, true, message.body, t, message));

}

if (t.runOnce) delete calls[ corId ]; }}}}

}

}

That provides RPC like communications – you register either Responder for result/error or directly call methods on the objects. You also pass through regular messages pushed from server without processing.

Finally, if you decide to code a server RPC response via server side event model you just move the code with the return in the appropriate event handler.

That’s all, folks ;-)

PS. I left out QoS and reliability information as every client has different requirements – but essentially you queue the messages and set up headers to provide out-of-band QoS and reliability info.

Comments

 

Grey Line

I decided to write this post after reading a blog called “Black Label from Adobe ”. This post has a photo of a black brochure that (according to the author of the blog) Adobe mails to marketing agencies in Russia. The brochure is titled “What would you do without Adobe in your life?”

This post is written in Russian, but I’ll translate the important part for you:

“Imagine, what do we feel when Adobe products are being used illegally. Install only licensed Adobe products. Do not take a risk, protect yourself from legal consequences of using illegal software.
Try to imagine that …
…someone has stolen your ideas you’ve been working on your entire life, and offers them as his own and receives an award for this…someone just fired you without paying for your work…someone has used your good reputation to sell his own products or services of a lower quality…and after doing all this tries not to be accountable for this stating, “What’s the big deal? There is nothing wrong with it, everybody does it”…

How would you feel?

In my opinion, sending these kinds of letters won’t help in the countries with very low salaries, especially if purchasing software is not a habit. Imagine a situation when you are giving a plate full of food to a hungry person saying, “Please do not touch the food until you’ll find utensils.”

This post has lots of comments made by Russian software engineers, and some of them make comments that they’d love to purchase licensed versions of the software, but they could not afford to shell out half of their monthly salary for a program. Another person writes that Microsoft sells their products in Russia for half price while Adobe sells CS3 in the USA for $998 and for $1500 in Russia (the author is not sure though who adds this markup – Adobe or resellers).

But having the right salary is not enough for starting purchasing software. Here in America, programmers can afford purchasing software, but not all of them do so. Usually employers purchase the software and employees are just using it for free. Lots of American programmers make illegal copies of the software and use it at home. People are getting cracked versions of software or just download serial numbers of the products from the Web.

Recently, one of the senior software engineers wrote that he does not want to use any software that is not open sourced. It’s a pretty weird statement. I’m sure this guy did not try to create and sell his own software.

Our company has created an open sourced code generator called DaoFlex. This was a command-line program with a minimal documentation. It was well received and we decided to create a more user-friendly version of this program as a plugin for Eclipse. We knew how to do it and allocated time and resources for this project. Since we invested into development of this plugin with our own savings, we decided that this will be a commercial plugin that we’d sell. To make the story short, in about 6 months the plugin was ready. We’ve spent more money on creating the Web site (www.myflex.org ) to support sales. We’ve written a license management module and ensured that the license will get expired after the trial period.

The pricing was the next question. How much should we sell it for? On one hand we wanted it to be affordable. On the other hand it should not be dirt chip either, because more sales means more support calls and the need to hire an engineer just for the tech support. And lastly, we’d like to at least break even by selling this product.

Anyway, we set the price of $399 for this particular plugin. People started purchasing this product, , and all in all we believe that the this product is not overpriced given the huge time savings that this code generator brings to any enterprise Flex/Java shop.

Summary

1. If our software will be cracked, I won’t get upset because it proves that we really created something useful.
2. Investing serious money into software protection is useless – hackers will break it anyway (if they care).
3. Our main perspective customers are corporations from developed countries, and they usually pay for licenses – this market is huge and we can ignore stolen copies of our software.
4. We may switch to a dual licensing model and will give our software away for free to individual users, but charge our corporate clients.
5. There is a small number of people that will pay for the software even if they can get it for free, but this is a minority, and it’ll stay this way for a while.
6. I believe that in 10-15 years most of the software will become available for free.
7. Fighting with software piracy is as useless as fighting with marijuana. A well known comedian M. Zhvanetsky put it, “This is not a fight and this is not a result”.
8. Instead of wasting money on mass mailing brochures asking wolves to become vegetarians, just spend these funds on lowering prices of your products.

Disclaimer. Last month I paid $20 USD for a shareware program that I use for podcast recording. One of the announced features did not work. I sent an email to the vendor’s tech support, but they never got back to me. Oh well, you get what you paid for.

Comments

 

Grey Line

While using Adobe Flex for development of the front end portion of your J2EE applications slowly but surely become a reality, many enterprise managers are still waiting for development of Flex ecosystem that would include a pool of professional developers as well as third-party components making Flex-related projects more productive.

Short learning curve, variety of Flex technical conferences and training seminars quickly address shortage of professional Flex developers.

Last year, Adobe evangelists have created online Flex component exchange where individuals and teams from all around the world started to offer their free and commercial components.

A new community site myflex.org is yet another step in further evolving Flex ecosystem.
This is a place that has been created to allow third party vendors offer their plugins and components for sale, and the first four components are ready to convert your Flex/Java application into a Rapid Application Development (RAD) project:

Clear Data Builder – this Eclipse plugin is a commercial version of an open source DaoFlex code generator. It takes away complexity of writing Java code for communication with relational databases. All Java and Flex artifacts are created automatically based on your SQL Select statement, including creation and deployment of the Flex FDS Web Application. You do not have to know Java to create end-to-end Flex-Java-Database CRUD application in minutes.

Fx2Ant – this Eclipse plugin instantly translates the settings of your existing Flex Projects into ANT build scripts, so that you can build your modules, libraries and applications outside of Eclipse and create larger builds integrated with J2EE projects. What takes weeks on even a mid-size project, can be done in seconds with Fx2Ant. While generating the build script, Fx2Ant applies additional size-optimizing techniques that help to modularize development and cut the download time of enterprise Flex applications.

Fx2Doc –this plugin allows you quickly build and organize the documentation for your project. You can upload your documentation to the corporate or the community server, so that it becomes shared by other developers.

Log4Fx – this component provides a number of configurable implementations of log targets and an interactive control panel. You can target your log information to Eclipse IDE, local or remote server and other destinations.

Given the time savings that these plugins bring to any project, their prices are nominal. You can download documentation and free trial versions of these components. A trial version of ClearBI, a very powerful, but simple in use Web reporter is also available.

While development of the front-end for enterprise applications in Flex is faster than in Java, using these components is a step toward a serious reduction of time to market. The above plugins were written using Java, XML and XSLT, but no knowledge of these languages is required. On the other hand, advanced users can customize XSLT templates to ensure that these plugins generate code or build scripts as per specific project needs.

The Web site myflex.org has been developed in Flex so Flash Player is required. Note the buttons on the right that allow you to hide the Web site’s header and/or switch to a desktop mode. The latter allows this Web site to “break free” from the Web browser frame. This mode should remind the users that rich Internet applications can be treated as desktop applications delivered over the Web.

If you’d like to offer your Flex component for sale, list it on myflex.org.

Yakov Fain

Comments

 

Grey Line

We are teaching yet another one-day Flex bootcamp on Sunday, June 24 as a part of the SOA World conference. No prior knowledge of Flex is required, but you should understand object-oriented programming and XML. This is pretty intensive hand-on learning (attendees bring and use their laptops), but at the end of the day you’ll have a pretty good understanding of what Flex is about, what are the challenges of developing enterprise applications in Flex. You’ll also get familiar with some Eclipse plugins that can turn your Flex/Java project into rapid application development environment.
We’ve taught this bootcamp earlier this year, and we’ll teach it again in several other cities across the USA later this year. If you’d like to join us, Sys-Con gave me a little something – just enter yakovspecial as the coupon code to get $50 discount.

If you have to jump-start a new Flex-Java project, this seminar will definitely help you.

Yakov Fain

Comments

 

Grey Line

Farata Systems will exhibit at the upcoming SOA World Conference & Expo, which will take place on June 25-27, 2007, in New York City. We also will teach a one day Flex Developer Bootcamp on June 24, 2007.

Rich Internet applications is a great way of consuming enterprise services, and we are going to demo our components that can substantially boost the productivity of software developers working on your Flex-Java application. We’ll demo the following products:
Clear Data Builder – this Eclipse plugin is a commercial version of an open source DaoFlex code generator. It takes away complexity of writing Java code for communication with relational databases. All Java and Flex artifacts are created automatically based on your SQL Select statement, including creation and deployment of the Flex FDS Web Application. You do not have to know Java to create end-to-end Flex-Java-Database CRUD application in minutes.
Fx2Ant – this Eclipse plugin instantly translates the settings of your existing Flex Projects into ANT build scripts, so that you can build your modules, libraries and applications outside of Eclipse and create larger builds integrated with J2EE projects. What takes weeks on even a mid-size project, can be done in seconds with Fx2Ant. While generating the build script, Fx2Ant applies additional size-optimizing techniques that help to modularize development and cut the download time of enterprise Flex applications.
Fx2Doc – this plugin allows you quickly build and organize the documentation for your project. You can upload your documentation to the corporate or the community server, so that it becomes shared by other developers.
Log4Fx – this component provides a number of configurable implementations of log targets and an interactive control panel. You can target your log information to Eclipse IDE, local or remote server and other destinations.
ClearBI – a Web reporter implemented in Flex and Java. It’s available in two versions: Professional Edition (Eclipse Plugin for developers) and Enterprise Edition (Client Business Intelligence Tool).  

Clear BI Professional Edition allows a software developer to create and customize a new report – sorting, grouping, formula fields –  in Eclipse IDE WYSIWYG style. Then, the report can be integrated into any Flex application.

ClearBI Enterprise Edition brings the power of customization to the business users,  allowing them start with the universe of the data fields, persist the modification to the database, share reports among users, groups etc. 

ClearBI is a first and only Web reporting solution for Flash Player. It does not require any software install on the client’s workstation – only a browser. Users running ClearBI reports can perform off-the-shelf analytics such as manipulations sorting, filtering and grouping; export report data to Microsoft Excel (IE only) and print PDF.

The documentation and the trial versions of all of these components is available at www.myflex.org .
Please stop by with all your RIA-related needs and concerns.

Comments

 

Grey Line

Do not miss tomorrow’s live TV show from Times Square on Rich Internet Appilcations. SYS-CON.TV’s will webcast an hour-long “RIA Shoot-Out” covering major Rich Internet Application (RIA) technologies.

Farata’s own Yakov Fain will participate in this discussion. If your firm is considering various tools and techniques for development of your next RIA, this show will definitely help you with making the right decision. This show will feature an interactive Q&A session from viewers during its final segment.

This free event will start at 1PM EST, and you can register at http://web2.sys-con.com/read/375328.htm

Enjoy the show,
Victor

Update: The short (edited) version of the podcast is available at http://tv.sys-con.com/read/385147.htm

Comments