Archive for the ‘ Notes ’ Category

Why ORM? ’cause:

Hi again, a few hours ago I have read a question about ORM mapping for java . He wonders why  and when this technology is chosen.

Disclaimer: I am omitting the case, when your database is just a storage for a CRUD apps. I am talking about complex applications, when stored procedures are used very extensively, like Oracle’s PL/SQL.

Read more

who needs implementations?

At least for some common patterns like DAOs.

As a popular manner, most of the java applications have at least three layers like UI, Service and DAO. For each layer you probably have interface and a single or more implementation classes.  And while UI layer has some really complex businesses for effective UI experience, DAO layer is only related with CRUD operations for a single or a group of beans.

Here is the routine that you can get rid of

Read more

Java7 Wish: Object/Bean Factory

One of the most critic point for java


return Class.forName(className).newInstance();

Upon since it seems this method bring the ultimate extensibility power to java.

But Now server & client applications became more and more complicated this feature became insufficient.

Read more

Annotations have been more successful than XML

Annotations came to JDK with JDK5 (2004) since then they evaluated and are accepted so widely and even became more powerful and useful than XML in just 4 years.

While you are developing a project with java at any scale you’ll need a very large number of XML files defined in very different API’s and DTD/XSDs. Which makes configuration very complex.

eg:struts.xml,tiles.xml,validation.xml,hibernate.cfg.xml,spring-context.xml,web.xml,and so on

Although it is easy to read and modify there are lots files :(

Now with annotations:

Read more

Code Generators OUT, Wizards IN

Code generation and development trends in java.

Brief History:Code Generation In Java

Code Generation was a must for J2EE because of lots of .xml, .java and .properties files . There are less code-reuse and less components. So if you are developing medium or enterprise applications your first step would be seeking a code generator. And finally you would find one or build a small code generator . And after some development and training you have something miraculous:Code Generated and lots of code working with pretty UI’s and interfaces.

Read more

hibernate cache injection: missing…

currently hibernate version is 3.2.5 and there is still something basic missing: cache injection.

Read more

Why I haven’t tried JPA?

I have been implementing java for 4 years and what I have learned: “not all Java API’s are good” but there are some open/vendor APIs you should prefer.

Read more

anti-JSF thoughts

more random patterns in the morning 'spresso

Image by Brian Daniel Eisenberg via Flickr

before I begin I should say, I tried JSF several times but all off them is bad.

Why?

Easy Navigation (!): Why do a framework disables back button and uses non-sense URLs? you cannot bookmark a single page, do not even try to read the URL it all sucks.

Always POST: why ? all non-sense and more no redirect after any post ?
nice article http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost

Restore View: Although it is in default life-cycle it would be %90 unnecessary and for any given insert page you will feed several combobox’s chechbox why ?

Complex Component Development: Although it is a component oriented framework it is harder to develop a component then a JSPTag.

Disable custom jsp tags all should be JSF oriented why ?

For All these choose any Action oriented framework: like struts,spring mvc,

more thoughts:

http://timshadel.com/blog/2006/01/19/jsf-the-7-layer-burrito-i-wont-eat-again/
http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost

Reblog this post [with Zemanta]

when do not generate code !

Cloud Factory

Image by saharsh via Flickr

Currently code generation is very common way of some handling common repeating code fragments and some initial setup task like startup configurations and so on. Some clear benefits are:

  • ease your setup process
  • protects your code form some common coding mistakes
  • maintain some coding pattern practices and standards.
  • keep your effort on complex tasks

    But on the other hand when you evaluate code generator or while writing your code should thing about ” why you generate this code ? and not writing some generic component to evolute such business
    this is the most common mistake while using this technology. you generate code to customize the generated code. If you not need this fragment to customization. DO NOT GENERATE IT. otherwise in most case any enhancement in these fragments will require great effort or worse (to generate again).

    so what is important.

    • more less code generated more perfect it is
    • more easily you customize it more useful it is

    Some code generators:
    http://www.codegeneration.net/