The New Service Layer Architecture.

I have been associated with 3 major softwares that were developed for corporates and large businesses. In each of them, I had seen somewhat common layered architecture where either a facade layer exists for the flow or did not.One of the three architectures had a dedicated facade layer on top of the service/business flows. Incidently it was the only application that was designed for the web.

That could be the reason where the architect might have envisioned mashups of business objects that might be requested from the client side.This decision seemed to be motivated by the controlled requests coming from the web vs the uncontrolled calls on a desktop application.But then, the speed with which the desktop applications have also started gaining back popularity since the past couple of years, it might not be incorrect to assume that the architecture of a web and a desktop application should overlap.The desktop applications are becoming more and more responsive and with an expert user the desktop application demand more challenging screens as compared to web applications.

It is with these understandings I propose the following layered architecture:
The core difference lies in the way the business service calls are divided into two sub layers namely:
1/Facade layer.:: Responsible for mashed-up/secondary business object screens.
2/Business Service layer.:: Responsible for manipulation of core business objects screens.

The process layer calls can go directly to the service layer and also can talk to the facade layer also.

For example, consider the problem domain of bicycles, where we are writing an application for selling of bicycles.

For the initial iteration, the service layer would be enough to cater to the needs of operations like getting a quote of bicycle from different sources, getting different color models, different frame sizes etc.

Later on the application owner might want to move to custom built bicycles where the complete bicycle is not the single object that is passed across the process and service layers, as wheels, frames,handle-bars,seat-posts all start bringing in different compositions for the custom build bicycle.
In this scenario, the facade would be a great place to assemble different parts of the bicycle bind them together and return to the process as the complete bicycle object.
Even later on when the bicycle sub parts are further broken down like the wheel composition can give multiple options to choose from, this structure can be extended further.

Some might argue that the facade layer can exist at the same level as the service layer. Quite true, but over a period of time when the service layer gets fat with lots and lots of business specific code being written, the objects that go in and out of this layer becomes unclear, as to the core set of objects around which the whole application revolves. This loss of focus from the core objects of functionality can result in a loss of a perspective in writing new code/flow for the application, the consequences of which can be differently dangerous in varied scenarios.

To conclude,I like this layout because:

1/ It keeps a unique object being passed across layers.

2/Multiple Do’s and Do not Do’s from design perspective get constrained for the developer.

3/Gives greater and cleaner objectivity to the flow of the objects in the complete application.The service layer can be controlled as one that caters to core business and the one that is responsible for supported objects.

4/Easy refactoring capabilities and pluggable architecture.

Is it fair to partition the service layer on primary objects?Does it limit the growth of the application(and business itself)?

What do you think?

The agile India Scenario

The extreme programming wave initiated by Kent Beck et al in 1999 and since then the mature world programmers have embraced that change. A lot many clones started from that movement like agile itself, and the much widespread like scrum and lean.
Although these methodologies(or approaches?) had existed since long time, I remember reading somewhere that motorola had these practices in place since the 1960’s.

Flash-forward to India, I do not know who or when was the first project here was done with the wisdom of sound agile practices? But since I stepped into the professional way of writing software(means I was paid for what ever I did or did not), I was fortunate to see a genuine mix of these practices from the very start.Moving on to different software vendors, I notice that India per say is yet to embrace agile in spirit.

I do not travel at all, but looking around the small sample of professionals(incl self claimed agilist’s) I am dis-heartened to say the least, when I see my self surrounded by a lot of certified SCrUM(pun intended).
No doubt it has made its mark and helped realize XP too, ever since I got to know about XP, I had(still do) predicted the end of the software manager(with MBA) as a career.
The point that I want to make across is that these managers have misused the insights from agile practices to abuse the Indian developer. I have seen(and heard) *only* Indian managers who have been doing this to their Indian counterparts.
I dare say if they are given a mix of developers from different geographies, they would not do the mistake of exploiting more work in lesser time.
That is like a blind person blessed with more powers.

That being the problem around how do I( or we?) as the Indian developer in the clutches of the Manager (with MBA) cope with it?

Ahh! Its a complex mix out there.There are managers without MBA also.
Need to get back to the drawing board and start afresh!

Overloading in C…..? ..Its possible…..

hi everyone..

since we started studying C language, we have been taught that method overloading is not possible in C..like everyone, even I believed that..
But yesterday I learnt that it is possible..by including a header file named STDARG.H.

This header file lets you create variadic functions.i.e. functions with variable arguments.
To perform method overloading, you just have to include this header file and declare a function which you intent to “overload” or provide variable inputs.

syntax:-
return type function-name( datatype1 arg1, datatype2 arg2,…);

Note:- the last 3 dots in the list(…), this is the one which tells the compiler that it would be taking variable arguments. It is mandatory to include these 3 dots(…) else your function would not accept variable inputs.

You can make a function which accepts same typed arguments or different.

The procedure to be followed is as follows:
1. you need to declare a variable “va_list” for iterating through the variable list.
2. then use macros like “va_start” – to start iterating through the variable list va_list.This macro takes two arguments. First the variable with type va_list and second is the name of the last argument given in the list. In the syntax given above , it would be arg2.
3. va_arg- to retrieve an argument from the list. In this macro you need to provide two arguments. First bariable of type va_list and second is the datatype of the next argument to be fetched.
4. finally, va_end macro- to find the end to the variable list.

Its really fun to work with this feature of C and perform a function which was said not to be possible in C.

This was just a jist about the header file and its macros.

Happy C Programming..!!!

Look Maa! No Tables Only Objects!

Databases are one topic that I have never had a chance to get deeper insights.

I started JDBC’ing when later I was surprised to know that one could connect to the database using ‘C’.

I had not worked enough to feel the pain of iterating over ResultSet and writing insert/update scripts that virtually went outside the screen when I saw the onset of “Hibernate-Relational Persistence for Idiomatic Java”. I never liked the writing/seeing/understanding XML, but I had no choice but to Well Hmmm!

And with most of the time spent in Hibernate, I never felt its features were intuitive to that of Java(in no specific order).

  • First and foremost in Java, Enum are first class citizens, in Hibernate, working with an Enum is not at all trivial.
  • Using composite keys asks you to maintain a seperate object for it.
  • Already there were two worlds of entities in Application(objects) and entities in DB(records), now to understand the two, one needed to know how Hibernate understands the two worlds.

For simple applications, Hibernate is way to work with, but with very large applications, I did not like the complexity that it brought in atleast two occasions, requiring extra time to keep the DB and the hbm files in sync.
It could be the incorrect way of not completely relying on hbm for schema generation, but because these applications had predefined schema’s, this was the only possible safe-path.

Issues with RDBMS:

  • Application<---->Mapping<---->DB
  • Cost of mapping conversion(second level cache’s are not enough!)
  • Transactions duplicates Locking- In general.

Tired of looking at xml, and with the option to write an application for fun, I have the option to evaluate the usage of Object Oriented Database.
I had found atleast a dozen implementation of such software, at the end it came down to db4o and Perst. And here is the summary of them:

db4o

  • Most commonly used OODBMS.
  • Easy to learn.
  • Supports intuitive Refactoring of persistent classes.
  • Support for Projections is not available(could not find).
  • Lazy initialization supported with default level of depth.

Perst

  • Has GIS Dataset
  • Fastest amongst all OODBMS.
  • Cryptic creation of indices for faster search.
  • Concept of Links for references pollutes domain.
  • No fixed DTD for import/export feature for refactoring.

Both the products have the following in common:

  • Support for Transactions.
  • Zero mismatch between object and saved data.
  • Confusing Licence!

At the end, I have to give in to db4o for simplicity and refactoring features.
And that’s where I would start looking at injecting it into the application.

Concerns about OODBMS:

  • Not Yet widely used – I wonder why?
  • Clustering – I do not need it.
  • Backup – RDBMS or File?
  • Optimization – Exotic feature than a requirement.

So I would look forward to working on the application on db4o and will update on the findings!

~rohit.

Decoding the SSO

I found this a year ago but i am sharing it now!
When i was developing multiple RoR apps about a year ago, there was one basic requirement, that of a SSO solution.

Err…. i hope you guys know what SSO is?
Well for those of you who are clueless, SSO stands for Single Sign-On.

Yes, SSO is one of the most important requirements of modern web apps. SSO enables a user to use multiple apps with a single username/password and the user needs to authenticate only once to use all the connected apps.

Take the example of Google! Have you ever wondered how you can directly access (without requiring to re-enter your credentials) your orkut/picassa account, when a moment back you were using gmail. Yes Google uses SSO!

Now for the decoding part, this is how Google does it:

Have you ever observed closely, what happens whenever you try to access any of the Google services for the first time?
The first request is always redirect to google’s main domain (i.e google.com) along with a set of parameters:
1. service -> which tells the service being requested
2. continue -> which tells the web location where the request should be forwarded after it is authenticated on the main domain

There are a few more parameters, but the above two are the most important.

Once you authenticate yourself on any google service, a cookie is created on the main domain. This cookie is checked whenever you try to access some other google service for the first time.
Once your identification is established on the main domain, another cookie with similar info is set on the service/webapp you are accessing (e.g. mail.google.com / orkut.com / blogger.com)
So, the subsequent requests to the same webapp, need not be redirected to the main domain for authentication!

The reverse happens, when you logout of a google service. The cookie on the current app is removed and then the request is forwarded to main domain to remove the cookie over there as well.
This makes sure that you logout of all the google services at one go!

For more info, on how you can implement SSO in your webapps, refer to these links:

http://www.jasig.org/cas
http://code.google.com/p/rubycas-server/
http://code.google.com/p/rubycas-client/

My triumph over MYSQL..!

My fight with MySQL has finally come to an end. It has been troubling me past few weeks.
I was facing troubles on installing it on my office PC. Finally I got it right..!!!! hurrayyy..I won over it..!

The error which was troubling was ” Error No:1045- Access denied for user ‘root@localhost’ (using password:YES)”.

the resolution is:
MySQL configuration wizard doesn’t set or reset the root password. It simply leaves the password as blank. Otherwise the installation is complete.

The crack is: On getting this error, go to MySQL Command Line. Press ENTER when it asks for password(because it has been left blank by the Server Configuration Wizard).
On the command prompt, type SET PASSWORD FOR ‘root@localhost’ = PASSWORD(‘newpwd’);

Now its running….

My JUnit Arsenal!

Writing unit tests for working on a piece of code is an exciting task that I enjoy.
To accomplish this with ease, for now my junit arsenal has the following approach:

1/ Mathematical Induction

2/ Boundary Value Analysis

3/ Permutation of the variables.

What’s yours?

Care to share?

Reverse Logic :: Launched!

Gang,

I am pleased to announce that we own a domain name on the world wide web!

we are *http://reverselogic.info*

Our next steps:

1/Subscribe to the gang(gangRemovemE@reverselogic.info)– ALL

2/Download the pencil plugin(firefox) and start sketching the screen
design how we want the web to reflect us!– ALL

3/Pen down how you would want your information made available on the
web for presence!–ALL

4/Pull your thinking hat’s on and start chalking out
mail-boxes/sections you would want to see on
http://reverselogic.info –ALL

5/Atleast feel excited! 🙂 –ALL(mandatory!)

Keep The Stir In!

~rohit.

2 CAME, PIZZA HUT SAW, GANG-STIR CONQUERED

Well, the title might sound a bit off track, there’s some story behind it. As all “Gang-Stirs” following this blog have read RK’s earlier post Somethings cooking! (stir-ring) me and RK met at Pizza Hut @ CP today (that explains 2 CAME, PIZZA HUT SAW part) and had a meeting of sorts (that explains GANG-STIR CONQUERED part). Without much further ado, I hereby put the minutes of the meeting (or discussion whatever one would love to call it):

Three broad points were on our agenda as outlined below:

  1. WHAT DO WE HAVE TO DO?

One of the important points is what are we going to do as a team if we become one. The discussion was centered around:

  • Get or identify guys from varied backgrounds and technologies together. Already few “Gang-Stirs” have been identified for ownership of various tracks:
      • Mobile: GG
      • JAVA (ranging from middleware to front-end): JC/RK/NA/HKA
      • Rails: SD
      • Database/Backend: AP

 

  • Find/search for ideas that click. You can think about anything under the sun, but the implementation of the same should be possible for you and other “Gang-Stirs” to implement.
  • A website has to be put up containing a small description of our work/ideas. RK is driving this effort and will update once done.
  • Search for a hosting solution that supports JAVA/J2EE and we badly need this to be in place to proceed further.
  • Ruby hosting solution has been found. Check out justhost.com for more info.
  • Finally, need UI experts to design nice layouts for our ideas. I know most of “Gang-Stirs” (if not all) struggle at it.
  • R&D was also discussed, but it’s more of an individual rather than collective effort.

2. WHAT WE HAVE BEEN THINKING OF DOING?

The second which we discussed about. Few ideas which came out:

  • BIKE-ASSIST: Kind of a GPS/navigation system which would assist bikers/motorists find next option in case of breakdown. For starters, might be implemented on mobile/web platform. More info would be available once we actually start on this.
  • A RUBY PROJECT: Something similar to National UID started by Govt. of India under Mr. Nilekani. But the difference would be the identity of the person would not be based on data like ration card or gas connection etc. rather it would be on his own individual identity. SD can work on this.
  • E-Commerce Engine: I have been thinking about this for long, but it involves lots of effort and R&D from initial plan to final product. Hopefully, would start on this and come up with more details.
  • Work on improving and contributing to open-source projects under Apache preferably. This can vary from developing eclipse plugins to working on actual source code. Apache Maven has been identified for starters to work on the same.

3. THE PREREQUISITES BEFORE WE START WORKING

I think this is the most important part one needs to focus on before doing actual work. Few prerequisites have been identified for starters:

  • Complete ownership of the identified track is a must. Apart from doing the actual coding this would include mentoring the new guys, taking additional roles/responsibilites etc.
  • Each track would be responsible for their deliverable. By deliverable we mean a final product which we just need to deploy or copy and it would work without much additional rework. Apart from the deliverable, each track should have an extensive documentation on wiki or any documentation platform explaining features/known issues or bugs related to their respective deliverable.
  • Most importantly, need to stick to best practices and standards while going about our job/passion.

Well, that’s the whole summary of our discussions. Please feel free to comment and suggest further so that we might have a better perspective while going about our passion.

ReverseLogic ~ Making Ends Meet!