Tuesday, November 29, 2011

GWT with JAX-RS (aka RPC/REST) Part 0 (preamble ramble)

This is a preamble ramble about deploying REST with GWT. To skip this GWT/REST advertisement, you should proceed to the next post.

What is the purpose of deploying REST when GWT-RPC suffices? Why REST with GWT?

There is an oft cited motivation for doing REST.
  • so that you could reimplement your client using Fortran, Cobol, PHP, Python, other whatnots.
  • OTH, so that you could reimplement your server using the above stated whatnots.

Honestly, those are insufficient excuses to do REST with GWT. The purpose of having a door on your house is not "so that I could have many locks on the door". Being able to have many locks is not the direct motivation, but is simply an enabler. Therefore, the above reasons combined with the following  reasons complete the motivation why you should deploy REST instead of GWT-RPC or XML-RPC or SOAP.
  • Scalability = Mashup-ability - multi-providers, multi war, application mash-up scenarios.
  • Scalability - loose coupling between client and server.
  • Visibility = Debugability - knowing exactly the data formats and schemata that are passed between client and server.
  • Standards = Visibility - I have no idea how to decode the transported data in GWT-RPC; however, JAX-RS allows you to employ established standards of JSON and XML object schemata - namely, Jackson JSON and JAX-B XML have become popular modes of object schemata.
  • Flexibility and Simplicity = Plugin-ability - loose coupling and visibility promote ease of development, enhancement and maintenance.
  • Flexibility and Simplicity does ensure that your application can be reimplemented in a more capable future language that would one day replace Java's popularity as a business enterprise language - just as Java had replaced Cobol. It's good to plan in advance for future contingencies - but having many locks is not the motivation for having a door.
  • Diversity and MVP-friendly - you could have a diversity of clients: Desktop heavy clients such as Swing, non-ASP .NET, Qt and light clients such as GWT, Qt. Qt is an interesting technology in that the same C++ code can be recompiled on Linux, Windows, and various mobile devices.
  • Agile - Visibility, Simplicity and Flexibility allows rapid prototyping using scripts, Fiddler2 (or its FireFox equivalent), to be replaced by proper Java code when the DTO and SAPI hierarchies become more complex and entwined.
  • Agile - allow a mishmash of services written mostly in Java but supplemented with script-based service providers.
  • Simplicity, Diversity, Flexibility, Scalability, Mashup-ability = Agile and gradual technology renewal. When it is time to upgrade any part of your service framework, a RESTful implementation would allow you to do it piece-meal. 
  • Bookmarkability. This is the strongest motivation in many projects to use REST. When a bank sends you an email letting you reset your password, it is probably a URL link to a REST service. REST APIs are convenient as bookmarks and actions links. For example, your grandma does not know how to update her profile but she asks you to do it for her. Fortunately that particular web site operates on REST. So you crafted a URL and mailed/skyped it to her, telling her to click on the link after logging in to her account she wishes to update.
  • RPC-ability. I don't think it is a hyperbole to say that many, if not most, RPC and XML-RPC proponents do not realise that REST can function as RPC. In fact, this series of posts focus on using REST as the RPC mechanism.
  • XMLRPC-ability. Using the right framework, REST is XMLRPC+the advantages of REST.
  • Terminologically SOAP - If you have used SOAP (Simple Object Access Protocol), you would agree that SOAP is a total misnomer because SOAP is not simple. Technically, REST is the actual simple object access protocol.

As long as your services or JEE server contexts reside within the same SLD-SOP restriction, REST would allow your GWT application to subscribe to multiple independently deployed server-side services. In fact, most enterprise GWT apps would need to subscribe to multiple independent services. For one, logging-in and user authentication should be a service of its own. Especially when you are using OAuth or OpenID.

You should see that GWT-RPC by itself is ill-equipped as a proper enterprise level enabler. GWT-RPC constrains you to only one service provider - the same service that serves the GWT UI itself has to serve the RPC service. Whereas REST would allow your GWT UI to communicate with another application context (i.e., deployed on a different war).

And then, if your service is on a different SLD origin, you could write a simple http proxy to forward-the-request/return-the-response, which invariably would run on its own war. In ancient terminology, a HTTP tunnel.


Continue next GWT with JAX-RS (aka RPC/REST) Part 1

Friday, November 18, 2011

The future direction of the human race

There is a double-headed pun here. Saying double-headed is a redundancy, but a pun may involve a three-way or n-way ambiguity of reference. So, saying double-headed means it is a two-way pun.

  • First, it reflects the socio-politic and economic race between humans.
  • Second, it means humans as a species.

The race among the human species will define the future of the human race.

The future of the human race is both bright and bleak. We are running out of resources. We are suffering under the effects of global warming exacerbated by human economic activities. Millions of born and unborn babies die from the effects of human triggered global warming. It is sad that those who most profess to protect the lives of unborn children are also the ones who most defend the need to suffer the effects of  increased global warming through increased human economic activity. It is devastating that social-conservatives promote a two-headed conflicted doctrine.

But there is encouraging news. The encouraging news is that the future of the human race is the android human. The future of the human race lies in genetically manipulated agriculture - which is good news to me.

Within the next 100 years
Babies will be given bio-genetic inoculation as soon as they are born, treatments which will continue throughout their lifetime. These would involve nano-bio-robotic structures (let's call it nbrs for the time being to reduce my need for typing) injected into the human body. They will receive these inoculations just as we receive our vaccinations today.

The structures will be programmed to diagnose and treat illnesses, diseases and disorders. When the human matures into an adult, they will have the capacity to decide to receive nbrs to enhance their physiological capacities. Human adults would choose to have regular dialysis for such treatments, just as we would go to the hairdresser.

Initially, the dialysis machines will be huge and located in clinics. But within 20 years of their general availability to the public, those machines would be transformed into netbook-sized devices. Such dialysis would not involve puncturing of tissues or blood vessels. The mode of permeation would be through minimal dermal-abrasion transfer - where nbrs would migrate through the skin. Nbrs will be programmed or configured to perform specialised functions. They may be programmed to embed themselves into the cellular structure of the body or programmed for gradual termination and destruction.

Nbrs is the ultimate answer to the cure for cancer. And for devastating conditions like AIDs and HIV infection. Nbrs will be deployed to facilitate tissue and organ rejuvenation and repair, or even replacement.

One issue that would escape biological technologists for the next 500 years will be taming the cellular reproduction counter. There is a counting mechanism that precludes cells from multiplying perpetually. In our current primitive state of technology, cells that lose that counting mechanism are cancerous. Currently, we have not much of a choice - to live healthily, we must die. Live free and die.


Therefore, between a hundred years from now till the next 400 years, a human person could choose to  gradually transform into a human android. And most people would do that, if given the opportunity. Cellular rejuvenation, cloning and replacing would at the most extend human life by another fifty years. As aging cells get progressively replaced by nbrs, including brain cells, a person would ultimately become an android.

This would percolate multitude of social, legal and ethical issues.

There is no escape from that technology being deployed. Governments may legislate, and private organisations may voluntarily institute moratoria against the technology. However, such moratoria would not hold well, like a dam against huge deluge of rushing water. The dams would crumble within 50 years of their institution.

When would a person become a total android - when a person's mental capacity is no longer supported by human cells. What would society do with these grafted androids? They think like the original person and have the memories of the original person. The android would be much more intelligent than a non-supplemented human and more resilient. In the beginning, such androids would be persona non grata. They would be issued a death certificate and be required to carry that certificate at all times as personal ID. Of course, the death certificate is in the form of a unique token. Not a piece of paper.

But within 200 years later, there will be a movement of android emancipation. Much like our gay emancipation movements today. Social Conservatives of those days will comprise of gays and straights who oppose the rights of androids. But more and more people will grow old, and more and more of us would gradually slide into becoming android. It is an easy decision to make a living will and choose to pass away abruptly, but it will be difficult for a person who is gradually transforming into an android to choose to terminate oneself because the android believes that he/she/it is the original person.

There would not be a chance of war between humans and androids because most humans would ultimately become androids anyway. Predicting a war between humans and androids would be like predicting a war between young people and the members of AARP.

The androids would be more resilient to super-luminal and extended galactic travel. In their socio-political distress they will guild themselves together and their social and economic structure will be far superior to that of humans, because their motivation would no longer be capitalistic but humanistic - the motivation not for the useless and non-utilitarian accumulation of wealth but the motivations towards rights of survival and achieving the technological ability to achieve that survival on another planet. Or under the surface of the oceans. The androids would also feel the obligation to leave this planet so that their descendants would have the resources to live on it.

Ultimately, android and human culture would merge again, as the technology of human-life extension progresses and as technology-induced biological evolution would draw a very blur line between being human and being android.

There should not be a case for dramatic worries. The sci-fi dramatization of humans self-evolving ourselves till we lose our ability to reproduce will never occur. Reproductive capabilities would be enhanced and there would sooner be a genderless society or a multi-gender society - and then a continuum of genders. Like the rainbow. The rainbow does not have seven colours - it has a continuum of colours.

These potential developments in the history of the human species probably sound frightening to most people of the present age. Many of us today would want to believe a messiah would come and whisk us away from living in such an age. But we are our own messiahs, and we are the chosen race - the human race.

It is in our responsibility to play-god. The Torah that I read mandates us to play-god. And not playing-god would be shirking our responsibility.

The words natural and organic have been having too much abuse. What is natural? The only meaning for organic I know is Organic Chemistry, which often involves chemical compounds that organicists consider as non-organic. Yeah, organic chemicals are mostly non-organic.

The resistance to genetically manipulated agriculture is ridiculous. My only reason to oppose GM agriculture is that corporations like Monsanto are bullying farmers and turning our society back into feudalism. The basic currency of the world, after all, is food. To control the world, it is not the stock market, not the financial streams and repositories, not the politics, but the ability to dictate how and what and when food is cultivated. And that is what Monsanto, et al, is capable of achieving. Our opposition to GM agriculture is playing into the hands of such corporations.

Embrace agro-GM to help ourselves to form large consumer and democratic pressure to prevent agro-GM from having the freehand they now have in enforcing unreasonable contracts on farmers. Under our current political climate, they are even able to enforce an involuntary contract on a farmer if they accidentally spill GM seeds onto the farmer's property.

Realistically, there is no other avenue to reduce global warming and yet have sufficient food and water for the world's burgeoning population, except in our embracing agro-GM to chart its development in a disciplined manner. Even if a complete convergence towards non-combustible power sources is successful. Especially with the emergence of an android class of persons.

We have the responsibility not only to conserve life but to create it. And to preserve what human life that would come into existence.


Resistance is futile - you will be assimilated.

drone
n. A male bee, especially a honeybee, that is characteristically stingless, performs no work, and produces no honey. Its only function is to mate with the queen bee.


A juggernaut in colloquial English usage is a literal or metaphorical force regarded as mercilessly destructive and unstoppable. The word is derived from the Sanskrit Jagannātha