Saturday, January 26, 2013

BBB-FORGE


BBB-FORGE
Prerequisites for BBB:
NPM (associate node tool)

Story:
One of the powerful frameworks to build a device agnostic / platform agnostic web app is using a RESTful backend and a backbone frontend.
Now, consider doing a web-app would involve at-least the following:
Backend to frontend.
a) Creating a Schema of the entity model that your app demands. (Scheme)
b) Mechanism to persist and retrieve these entities.       (Persistence Layer)
c) Mechanism to expose these entities over http and     (RESTful services)
d) Maintain / Validate / Manipulate / etc... these over the client browser.            (Client framework).

Let us come to what software we would use,
I am pretty impatient and want my webapp to be available in a jiffy.

Database:
I would consider an in-memory DB to any of the other costly (w.r.t time / energy) setups Oracle / Sql Server, etc.
So what are my options, a) HSQLDB or b) SQLite (file based)?
Of course of the MySQL is one extensively provided by website vendors, but I would rather consider something I don’t need to do a JDBC Uri.


I would not like to write all my create / update / insert statements for setting up a base DB,
What are the alternatives? I want someone who can understand the need of creating a project
Which has persistence framework defined and is also intelligent of creating DB scheme based on my pojo model?

What if I am reluctant to write my pojo's defining entities?
Is there anyone who can ask me few simple questions and create my entities??

What else do I demand from this aid?
Can this aid expose over in a RESTful way all my entity models?

Wow... so we are saying that a tool
Which will ask me few questions like, what is the entity you want to create?
What fields does the entity hold?
Create Scheme + Persistence entity model + RESTful services on these entities.





Action:
Installation of Forge:
http://forge.jboss.org/

Method 1:
Download + extract + run.
As simple as that.

Method 2:
Go to eclipse market place and search for jBoss Tools.
Install all of the tools (nearly 50 of them).


Using Forge:

Open the command prompt and type forge.
In eclipse, Window --> show View --> search forge.
Click on the green triangle to start forge.

-- Unless otherwise specified, assert all the questions.

Creating a new project using Forge
new-project --named <ProjectName> --topLevelPackage <TopLevelJavaPackage>


Talk about Persistance
Configure DB connections.

 persistence setup --provider HIBERNATE --container JBOSS_AS7


Creating entities:
entity --named Tweets

field string --named tweetTxt
field string --named tweetID

RESTful entities:
rest setup --activatorType APP_CLASS

rest endpoint-from-entity --contentType application/json <TOP LEVEL model Package>

You are done of defining schema + writing ORM layer + exposing these as RESTful services, by running just 7 commands.
Use mvn commands to package the above app for server side deployment.







The client side story
-----------------------------------------------------------------
bbb comes to the rescue.



npm install -g bbb

Once you have it,
Create HTML5 web-app by

bbb init

Create modules in the app by

bbb init:modules
Provide the module name when asked, and happy UI designing then on.


-----------------------------------------------------------------


References:

Thursday, November 15, 2012

Designations

    Once upon a time, there lived a boy Jan, who wanted to write. Jan scribbled all day to get the words right, changing his hands left and right. Jan spent all his free time trying to write. Jan saved time from classes, which didn't happen, to learn to write. At times his pen slipped off his hand and at times his fingers wouldn't yield to move, but still Jan kept practicing to write. On completing high school Jan was able to write a 1000 worded comprehension, which was the best in his class.

    Jan proudly entered the college gate, to only find 100 others, who could write the same. Few could write faster than him, few could write clearer than him and few could do both. It was an examination day, when Jan was asked to express the scenario where he got a penny from his dad and was asked to get some spices home. Jan could think of 100 things, his thoughts wandered over 10000 feet above ground and wanted to present the best of writing. His writing sounded like a lenghty boring para without pulling any interest into the details, but Jan was happy as none could do any better.

    Jan soon got into a work, his main job was to write. Writing was taken seriously at work, with scrutiny on the type & spellings of words, basic grammar used. He learnt the art of using punctuations acurately, with concise sentences. With work getting repetetive, he kind of mastered using various spellings, best usage of basic grammar principles. Given a para he could represent it the best. He was fed up with the job after a while and he joined a editorial. He learnt the advanced usage of grammar like the transitive verbs, using abstract nouns with interrogative pronouns, etc.

    As the saying goes, "Practise makes man perfect", Jan was perfect in demonstrating advanced grammar techniques and his writings was exemplary, given a thought, he could express it into one of the best writings. Jan felt there is still a but in his writing. He felt his essays were fantastic in grammar techniques, but the correlation and rythm were not perfect. He found essays of few of the senior editors which had flow and correlation alongside rythamic effect in writings. He soon realized the missing bit and could write to a poet's satisfaction, he could mix multiple thoughts and bake poems out.

    I often get confused as to what the designations would mean to the deliveries. To my wonder I hardly find people to clarify this. As Shakespear said, "what's in a name", I felt what is the fuss about a junior developer, developer, technology lead and an architect. What value add are all these adding to the final delivery ? how much of this is fat ? If you have ever face this kind of confusion let me get you out of jail in this article. I think analogies are best way to explain things. Let me guess, I think writing comes close to development and lets delve in straight to understand the importance of roles.

    Oh my! I forgot to introduce you to Jan, he is a boy interested in coding and ended up as an architect. Walk back the article to find what is the meaning of an Architect (Poet) to a technology lead (editor) to a developer (writer) to a junior developer ( an under grad). Hopefully the analogy of writing to coding should explain the gist. Bidding off with a quote from the master of algorithms.


    "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be aesthetic experience much like composing poetry or music." -- D.E.K