Thursday, September 06, 2007

Framework ?


Software people should often hear this term ‘Framework’. What is it all about? The picture you see looks like an exploded building. But, you see the steel skeleton standing alone right? That’s Framework. That is some thing that supports the building architecture and gives a structural support.

I am thinking of writing a framework for my pet project. Especially for database persistence and queries. It might simplify coding complexity and speedup writing of code. Because, frameworks can provide basic structural support for projects. Also, it can help to eliminate boilerplate code found here and there in projects. When I imagined, how the coding style could change if I develop a framework, it turned me excited.

Few lines about Framework:

1. Usually, at the beginning of projects, Architects do some basic works -- one of them is building a Framework.
2. A Framework will offer basic structural support and services. For example, accessing a database is a common scenario in any project. We end up writing database access calls every where in project; every where we need to handle transaction, synchronization and etc. This plate of code can be moved into Framework and can be accessed from any part of the projects. Like wise, a Framework can have basic and structural functionalities for a project. Change/upgradation in code/functionalities can be done in one place, that’s in the Framework level, and dont need to change every part of the project.

A cool example,
Suppose, if you want to insert some values into database, you write painful code like this,

-------------------------------------------
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection(connectionURLThin, userID, userPassword);
PreparedStatement preparedStatement = con.prepareStatement("insert into emp(?,?,?,?)");
preparedStatement.setInt(1, 100);
preparedStatement.setString(2, "mani");
preparedStatement.setDate(3, new Date());
preparedStatement.setDouble(4, new Double(46000.50));
preparedStatement.executeUpdate();
con.commit();
preparedStatement.close();
con.close();
-------------------------------------------

Ssshh! Take a break and come back :-) Just think what will happen if one need to repeat this code everywhere? That’s something called 'boilerplate'.

Rather, this can be abstracted/wrapped into a Framework, like

-------------------------------------------
MyDatabaseFramework.persistValues(100, "mani", new Date(),
new Double(46000.5)); // this single line code will insert, commit & save your head.
-------------------------------------------

That’s what Framework is, and that’s something, I am planning to write. Now Framework can be abbreviated into single word, "COOL" -- isn't?

1 comment:

Admin said...

This is the best post ever, will like to read more from you.
I came across some race horse and a camel supplements for pre race stimulant and anti inflammation. Here you can see more
Buy Poison 15ml Online
Buy Kynoselen 100ml Online
Buy Bio blocker 100ml Online
Order Fluvet 50ml Online
Buy Diurizone 50ml Online
Buy Dexarace 20ml Online
Buy Dexapheylarthrite Online
Dexacortyl 100ml Horse Camel Supplements
Buy Dexa-Chlorid 50ml online you can as well whatsapp text +1(415)237-3209 , wickr: maxme007 or email:miradukes6@gmail.com for more details