The Book of DOJO
What are the differences between jsId, dojo.byId(), dijit.byId() ?
DOJO Introduction - Page 1
DOJO Introduction - Page 2
Sitepen Blog - DOJO Grid 1.2
DOJO Hitch function
DOJO Podcast
Measure Javascript load time using Cookies
DOJO 1.2 Release Notes
Fancy Round Corner divs
Thursday, January 1, 2009
Saturday, September 15, 2007
Java Threads
I found this article about Java Thread and its life-cycle very short, precise and importantly easy to assimilate. Especially the diagram is illustrative and visually easy to grasp.
Refer Java Programming Language by James Josling, Ken Arnold and David Holmes. A great book for all Java Programmers and unfortunately I found many Java programmers not having it in their book shelves. Though I haven't been able to master Java as I expected, but as I own this book, I have lot of confidence in getting my doubts about the concepts clear. Below are some of the points I collect from this book.
1. Thread - Abstracts the concept of worker. It will do what you give as work and thread scheduling algorithmm will decide when the worker has to do your work.
2. Runnable - Abstracts the concept of work.
Refer Java Programming Language by James Josling, Ken Arnold and David Holmes. A great book for all Java Programmers and unfortunately I found many Java programmers not having it in their book shelves. Though I haven't been able to master Java as I expected, but as I own this book, I have lot of confidence in getting my doubts about the concepts clear. Below are some of the points I collect from this book.
1. Thread - Abstracts the concept of worker. It will do what you give as work and thread scheduling algorithmm will decide when the worker has to do your work.
2. Runnable - Abstracts the concept of work.
Wednesday, August 29, 2007
Spring IoC - A Quick look
Spring's IoC is one major feature of Spring framework. Martin Fowler has beautifully made clear and explained what IoC is about. You can find his article on Ioc here.
Spring configuration file as XML describes how to configure the classes. Who is dependent on who and how to give them what they want. As per Martin Fowler's article, instead of MovieLister picking itself the specific implementation of a MovieLister, we configure Spring to inject this MovieFinder implementation into MovieLister. Thus MovieLister can act as a plugin with no dependencies within itself.
How to inject them ? Three ways exists as mentioned in the article
1. Type 1 - Interface injection
2. Type 2 - Setter injection
3. Type 3- Constructor injection
Spring supports both type 2 and type 3 injection. Constructor injection is favoured when working with Spring and it is simple of all for those who have been regularly working with JavaBeans specification.
Dependency Injection is opposite to Service Locator. When to choose between them depends on how you want your services to be utilised. For simple services which are not used much outside the application or the specific module, then simple Service Locator will suit. But if there exists a functionality which needs to be executed in simulated mode and production mode, you can very well use dependency injection. The simualted mode will have unit test cases which can be changed over and over and provides a clean testing of the functionality without any regression coming out of touching your actual application code.
Judgement is the Key. Shouldn't get carried away. Numerous solution exists for every problem but what suits ? This requires better understanding of the application.
Lets see how spring.xml would be for the moviefinder and movielister example
Spring configuration file as XML describes how to configure the classes. Who is dependent on who and how to give them what they want. As per Martin Fowler's article, instead of MovieLister picking itself the specific implementation of a MovieLister, we configure Spring to inject this MovieFinder implementation into MovieLister. Thus MovieLister can act as a plugin with no dependencies within itself.
How to inject them ? Three ways exists as mentioned in the article
1. Type 1 - Interface injection
2. Type 2 - Setter injection
3. Type 3- Constructor injection
Spring supports both type 2 and type 3 injection. Constructor injection is favoured when working with Spring and it is simple of all for those who have been regularly working with JavaBeans specification.
Dependency Injection is opposite to Service Locator. When to choose between them depends on how you want your services to be utilised. For simple services which are not used much outside the application or the specific module, then simple Service Locator will suit. But if there exists a functionality which needs to be executed in simulated mode and production mode, you can very well use dependency injection. The simualted mode will have unit test cases which can be changed over and over and provides a clean testing of the functionality without any regression coming out of touching your actual application code.
Judgement is the Key. Shouldn't get carried away. Numerous solution exists for every problem but what suits ? This requires better understanding of the application.
Lets see how spring.xml would be for the moviefinder and movielister example
Spring - Part I
Disclaimer : This post starts with a different intent of putting "my" thoughts / understanding of Spring. This doesn't target any section of people who work with Spring or trying to learn Spring. Infact, I start with lot of questions as to why Spring and what makes it so unique in J2EE world.
Spring is an open-source framework created by Rod Johnson and it addresses the major complexities involved in developing enterprise application , especially when EJB is involved. At this junction to say simple benefit of Spring is that it is POJO (Plain Old Java Objects) based.
Spring is lightweight inversion of control and Aspect Oriented framework.
Inversion of Control
When IoC is applied, objects get their dependencies from the Spring container rather than the objects looking themselves for the dependencies. Reverse JNDI to say in simple terms.
Inversion of Control is a loose term. It is interchangeably used with dependency injection. Dependency injection aptly says what IoC is all about.
Aspect Oriented
Business logic are mostly in verticals. An enterprise would have core businesses align as verticals with dependencies among each other. OOP is a perfect paradigm for such business problems where reusability , maintenance , scalability are key. In each business function, we could find certain repetitive functionalities which are not 100% related to that business function. Rather they appear scattered across all business modules. Typically they are horizontal functions or simply cross-cutting concerns. OOP is best for vertical functions.
AOP solves the problem by giving aspects such as logging, transaction management, authentication to the business methods. Thereby the code is cleaner, easily testable and maintainable.
A cliche example of aspect : Logging. If you have already known this example, excuse me for not giving a different example. But to make someone understand what AOP, logging is the best feature to explain. Loggers typically appear at will. Typically at the start and end of the method. Why dirt the code with logger statement when it has cleanly done what it is expected to do. Logging is an aspect and you can ask Spring to do the task of giving the advice and when to give the advice.
Spring framework is made of many modules. It is not necessary to use all the modules to be able to completely work with spring. Thats what makes Spring unique. Struts is good but there is a tight coupling when it comes to integration with other frameworks. Spring allows easy integration for other frameworks. If you want to either TopLink, iBatis, Hibernate as your ORM quite easily with Spring. Ok.! Lets see what are the Spring modules
All modules are built on top of the container which is the heart of Spring. A container is J2EE context is that provides the low-level services which are essentially the building blocks of enterprise application.
Spring is an open-source framework created by Rod Johnson and it addresses the major complexities involved in developing enterprise application , especially when EJB is involved. At this junction to say simple benefit of Spring is that it is POJO (Plain Old Java Objects) based.
Spring is lightweight inversion of control and Aspect Oriented framework.
Inversion of Control
When IoC is applied, objects get their dependencies from the Spring container rather than the objects looking themselves for the dependencies. Reverse JNDI to say in simple terms.
Inversion of Control is a loose term. It is interchangeably used with dependency injection. Dependency injection aptly says what IoC is all about.
Aspect Oriented
Business logic are mostly in verticals. An enterprise would have core businesses align as verticals with dependencies among each other. OOP is a perfect paradigm for such business problems where reusability , maintenance , scalability are key. In each business function, we could find certain repetitive functionalities which are not 100% related to that business function. Rather they appear scattered across all business modules. Typically they are horizontal functions or simply cross-cutting concerns. OOP is best for vertical functions.
AOP solves the problem by giving aspects such as logging, transaction management, authentication to the business methods. Thereby the code is cleaner, easily testable and maintainable.
A cliche example of aspect : Logging. If you have already known this example, excuse me for not giving a different example. But to make someone understand what AOP, logging is the best feature to explain. Loggers typically appear at will. Typically at the start and end of the method. Why dirt the code with logger statement when it has cleanly done what it is expected to do. Logging is an aspect and you can ask Spring to do the task of giving the advice and when to give the advice.
Spring framework is made of many modules. It is not necessary to use all the modules to be able to completely work with spring. Thats what makes Spring unique. Struts is good but there is a tight coupling when it comes to integration with other frameworks. Spring allows easy integration for other frameworks. If you want to either TopLink, iBatis, Hibernate as your ORM quite easily with Spring. Ok.! Lets see what are the Spring modules
All modules are built on top of the container which is the heart of Spring. A container is J2EE context is that provides the low-level services which are essentially the building blocks of enterprise application.
- Spring Container : Fundamental of Spring. Spring's BeanFactory is the heart of Spring based application. BeanFactory provides the IoC.
- Application Context module : Extends the container module to provide internalization support, EJB integration, life cycle management. (Not very clear. Superficial now)
- Spring AOP module : As discussed earlier, this makes Spring an AO framework. Spring AOP API confirms with the AOP Alliance API specification and hence can support interoperability of AOP implementations
- JDBC abstraction and DAO module : Imagine flyweight pattern. You can bury complex database calls, connection establihsment under a set of classes and expose them to your business calls. Declarative transaction management possible through this module which inturn depends on AOP module. Meaningful exceptions are available and thus you needn't decipher the SQL Error code to track what the exception is and why it occured.
- ORM integration module : Integrates well with any ORM framework. It provides hooks to major ORM frameworks like Hibernate, JDO, iBatis
- Spring Web Module : Allows easy intergration with other MVC frameworks like Struts. It is built on top of application context module and very much into request-response management, programmatic binding of request parameters to business objects
- Spring MVC framework : Spring also gives a separate MVC framework eventhough it supports good integration with Struts. Importantly this uses IoC to segreggate neatly the role of controller from business objects. Multiple view possible using Spring MVC
Tuesday, May 29, 2007
How to present ?
Well ! I started this blog to pen down good references , notes on any topic which I would like to explore and share it with others. Looking back at what hit upon this idea, would be interesting.
I'm lazy. Others are also lazy but sometimes I'm so lazy that I cannot even refer to materials which I have bookmarked. The content though gives me what I want, the way it is presented never attracted me once I had got the gist from the link. I never revisited them. Bad !! Font size, target audience, starting point, future direction are really important when we write an article. When you have something that is yours, the efficiency of its usage multiplies. Informal writing works well here. Scribble something in the corner of the page and it attracts you more than the bold notes in the page. Isn't ?
Next comes to how should I make it readable for others as well. Making it as informal and non-structured as possible could help. My policy - Unix Philosophy of KISS - "Keep It Simple and Stupid"
Even scanned notes could help in long way to retain what you learned.
Lets see how far my interest goes here :-)
I'm lazy. Others are also lazy but sometimes I'm so lazy that I cannot even refer to materials which I have bookmarked. The content though gives me what I want, the way it is presented never attracted me once I had got the gist from the link. I never revisited them. Bad !! Font size, target audience, starting point, future direction are really important when we write an article. When you have something that is yours, the efficiency of its usage multiplies. Informal writing works well here. Scribble something in the corner of the page and it attracts you more than the bold notes in the page. Isn't ?
Next comes to how should I make it readable for others as well. Making it as informal and non-structured as possible could help. My policy - Unix Philosophy of KISS - "Keep It Simple and Stupid"
Even scanned notes could help in long way to retain what you learned.
Lets see how far my interest goes here :-)
Subscribe to:
Comments (Atom)

