Archive for the ‘Product Development’ Category

Flex Framework for SalesForce Apps- Part 3 Working

September 18, 2010

In the last part we have seen the framework specifics. In this part lets see how it all comes together. There are several classes that we need to create. Before we get there lets look at the way the salesforce toolkit works.

There are a few toolkit classes that we need to know:

Connection: This class is responsible for communication with SFDC. Connection allows querying as well as calling webservice methods. For metadata the Connection2 class has to be used. The key methods are login() and execute()

AsyncResoponder: When a request is sent to salesforce a responder is associated to it that is responsible for handling the result/fault for that call.

Parameter: All request parameters need to be sent as an Array of objects of type  Parameter class. A vector would have been ideal in this case however the toolkit comes from Flex 3 days.

Lets look at the framework components and the end to end flow.

The core idea is MVC based where we have a controller who is responsible for making decisions on service and handling the business logic.

The fundamental approach of accessing the service is the Command pattern. This is pretty much like cairngorm except the fact that we are using the com.salesforce.AsyncResponder class for handling responses. The reason is simple. The execute method in the Connection class expects and object of AsyncResponder. Hence we can simplify the code drastically.

The Command class can be seen as a helper to the main Controller class where it takes away a responsibility from the controller of sending a particular request and handling its response. It implements an ICommand interface which includes an “execute” method. This method is responsible of sending the service call and extends from the AsyncResponder class due to which the result and fault methods need to be overridden.

All these requests are generated from a view (or other commands) where the notification travels in form of an event to the controller and based on the event the controller invokes the correct Command. This does not require the event to be of a specific type rather it can be any event with the bubbles property set to true.

RC4SF - view controller

RC4SF (View Controller Flow)

The Connector class is the service layer which in our class is a class with 2 static members. First the connection object from salesforce which can be used for login or describing an object. And second the invokeSFDC method which will call the correct webservice method.

The steps are simple:

1. Create and instance of the Controller and pass the reference of the main application

2. Dispatch an event from application with bubbles set to true

3. Create a command to handle request from the events

4. In the controller add association of the event being dispatched with the Command

5. Call the SFConnector classes invokeSFDC with correct parameters

6. Handle result/fault in the responder which called the request

Here is the code for this bit. At the end of all parts will be uploading the framework and a sample/template application

/**
Connector class
*/
package com.tekno.rc.service

{

import com.salesforce.AsyncResponder;

import com.salesforce.Connection;

public class SFConnector

{

public function SFConnector(){

}

public static var connector:Connection = new Connection	();

private static var _webServiceClass:String;

private static var _namespace:String;

public static function set webServiceClass(value:String):void{
_webServiceClass = value;
}

public static function get webServiceClass():String{
return _webServiceClass
}

public static function set namespace(value:String):void{
_namespace = value;
}

public static function get namespace():String{
return _namespace;
}

public static function invokeSFDC(method:String,args:Array,responder:AsyncResponder,webServiceClass:String="",namespace:String=""):void{

var _ws:String = _webServiceClass;

if(webServiceClass.length > 0){
_ws = webServiceClass;
}

var _ns:String = _namespace;

if(namespace.length > 0){
_ns = namespace;
}
connector.execute(_ws,method,args,responder,_ns);
}
}
}

The Control class:

package com.tekno.rc.control

{

import com.tekno.rc.control.commands.ICommand;

import flash.display.DisplayObject;

import mx.rpc.AsyncResponder;

public class Controller
{

private var app:DisplayObject;

public function Controller(app:DisplayObject){
this.app = app;
}

public function mapCommandToEvent(eventName:String,responder:ICommand):void{
app.addEventListener(eventName,responder.execute);
}

}
}

In the next part we see an application working with the framework. And the entire source code

Flex Framework for SalesForce Apps- Part 1 Warm Up

September 7, 2010

We have been working on a few sales force – flex apps for our customers since last September. Initially all the entities involved can really overwhelm you. It is extremely critical to get the application architecture right because the data model is mostly dynamic and also the toolkit has its own overhead.  We are trying to share the approach that we use to build SFDC – Flex apps.

Let warm up. Starting from salesforce terminology:

1. ToolKit: Salesforce.com provides a toolkit (actionscript library) using which you can communicate with the salesforce.com platform. Using this toolkit gives a head start to your SFDC- Flex Apps

2. Apex Webservices: SFDC has a language called Apex using which you can create webservices to access you application. It is predominantly based on Java, however, there are a few restrictions

3. Visual Force: VisualForce or VF is a UI technology for salesforce, primarily driven on Ajax it allows integration of Flash components (read SWF) into it. You can write JavaScript into it and hence has a big advantage. There are other UI things like S-Controls which we need not look into now.

4. Static Resource: In simple terms a static resource is any media,document,file which needs to be uploaded to SFDC for your project. So the SWF will be uploaded as a static resource. (Rather the entire output folder from flex)

5. <Apex:Flash>: This tag is used inside the VF page to help you embed swf. You can pass FLASHVARS set height, width.

6. Briefcase (AIR apps): Briefcase is a SalesForce concept using which you can create off-line applications. Add objects to the briefcase (though some objects like case can not be added to it) and then you can sync data from your off-line application.

7. Org: Your part of salesforce.com which you can customize and use as your requirement. Every customer has his own org and his own installation (package) of the application

8. sObject: sObject refers to any object that can be stored in the Force.com platform database. An sObject variable represents a row of data and can only be declared in Apex using the Web services APIname (the name with which the object is identified) of the object. This is of high importance as most webservice communication will involve sObjects

You can build you project either based on web-services or write the business directly onto the flex calsses, we do not use the later as we want flex to be unaware of the core business and keep it as generic as possible. However the framework is equally applicable to any type of project. ideally on the salesforce front if you are making webservices there should be good care taken to ensure only one webservice class is exposed to flex and the rest of the things can be in remaining wrappers.This keeps the architecture much more robust and generic.

Some warm up on the flex side (assuming you know flex):

1. Depending on the type of project you want to build (Flex or AIR) include the SWC of the toolkit which can be downloaded from here

2. It is good to have the code linked for the SWC since you will need to go to and fro

3. Setting up the architecture:

Apart from flex UI, the architecture contains 2 key elements: 1. The Controller and the Async Tokens

In the next part we exclusively look at the concept of the architecture, various entities and the working.

The business of wire-framing

July 17, 2009
With emergence of web 2.0 everything is going online. Websites are no longer small partly usable entities but have grown in to become full fledged applications. With this the scope and expectation of a web application have risen dramatically over past 2 years. Everybody want’s an intelligent good looking and robust application developed quickly and in budget. But how good does it go when we get real?

If you want a web-application to be developed or are a developing one it is extremely important to look at the process that you are following. Some rough requirement document, some inputs from the technical team and some rough ideas? Why do you think so many software projects fail or lose track and overshoot time and effort estimation?

This incorrect estimation comes due to lack of clarity of the requirement and the process. Isn’t there a clear disconnect between your ideas and the person who is implementing them? How do you bridge the gap? The answers is WIREFRAMES

So, what is a wire-frame:

A wire-frame is a pictorial representation of data (and not design) of your application.  Creating a wire frame is normally an iterative process which involves some Business intelligence, Product technical know how and a usability analyst to come together. It could be a PPT or there are several tools available like Omnigraffle, Axure, MockupScreens or for that matter open office draw. It is like they say, always write an algorithm before you write an implementation. Wireframes bring an application flowchart and work flow algorithms to an easily understandable level.

In the first iteration ideally you would want the person who understands the business to roughly sketch his ideas on a piece of paper. As an iteration a Usability Analyst armed with the technical know how and behavioral aspects of a web application can start mapping them onto a wireframe.

Wire frame is not how your application but what it contains and some part of how it behaves.

 The 3 major advantages which impact everything from time to cost and success of the project are:

1) Wireframes increase the clarity about the application that you are getting developed or developing. If  there are any uncertainties or challenges they can be handled right at the beginning. The picture becomes more clear on every single piece of information that the system will get in or display. You do not want to create something you cannot sell, right?

2) Better estimation of cost and time: No doubt creating a wireframe would bring in its overhead on cost and time. But if you look at the overall picture it simplifies things for a developer/technical architect to such an extent that they can virtually see what they want. Also a  designer can create the views with better understanding and focus.

3) Project management: As the application grows and comes closer to being realized that’s when you can expect some major surprises. A wire-frame coupled with an iterative release process will ensure that you get what you expect

It is again not necessary that you stick to the wire frame as is. While the application gets developed there will be challenges and constraints however the magnitude of problem and the time taken to get over them will reduce drastically

I think in a nutshell. No wireframes there is a very little chance of you getting a quality product in time.

 

A sample wireframe:

A Sample Wireframe build with powerpoint

User centered design – the new way of life at Tekno Point Multimedia

July 2, 2008

As an entrepreneur , I always strive to sow seeds well in advance to reap benefits in future. For e.g. in training division we upgrade to topics before they become popular in the mainstream , this helps not only our students but also our DnD and consulting division to leverage the before time preparedness to handle customer requirements.  Last 7 years of our existence we have spent our time in helping others adopt flash platform either as a skill or as a solution.  In 2008, we chose to take the bold step of trying to build our own product. Suddenly we were in a situation which we were not used to , no input from clients , no one to tell us what is required , no one to take feedback from and worse, no one to blame to.

It was really annoying as I  was unable to define my requirements clearly to my team and perhaps equally annoying for my team to get a different brief every time we met over this issue.  

I had no clue how to solve the problem we were going through.  But as the saying goes ‘ If you really want something , the entire world conspires to give it to you‘ . I got my solution in a course being offered by Atul Joshi of Design Incubator. Not only the course , even the schedule was conspired to suit my needs, it was over the weekends. So there I was in his class where I came across for the first time to  the world of User Centered Design. The last lap of my training is still pending , however , UCD is on its way to become a new way of life at Tekno Point Multimedia. I am encouraging all my team members to take a deep dive into UCD and have filled the library with books on UCD, usability , user experience, information architecture etc. It is an absolutely different kind of upgrade that we are going through , but I am sure that our DNA of constantly upgrading ourselves will help us in adapting UCD as a process in Tekno Point Multimedia. It is a huge paradigm shift for all of us and I am ready to wait as long as it takes to make UCD a second nature. 

Yes, It will grossly delay our timelines of coming out with our own product.  But I think its worth all the delay , someone once told me ‘ There is always a room for a better mouse trap‘ .

 

Cheers,
Himanshu Mody
Founder and CEO. 


%d bloggers like this: