• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Question for Chris Richardson : what do you call POJOs ?

 
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A question for Chris Richardson whom I assume he perfectly knows the definition of a POJO :
there seems to be 2 definitions for POJO, it's either a plain old Java object, that is a normal Java class, or a Javabean class, with getters and setters.

So, which one is it ?
 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dont forget that a Java bean is also a POJO.
 
Ranch Hand
Posts: 51
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But what I have heard is,
POJO: Pure Java Object.

Which is the correct one?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
POJO == Plain Old Java Object
[ January 24, 2006: Message edited by: Paul Sturrock ]
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is Plain Old Java Object???
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Hemant Agarwal:
What is Plain Old Java Object???



http://www.martinfowler.com/bliki/POJO.html
 
author
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

The most definition of a Plain Old Java Object (POJO) is an object that does not implement any special interfaces (ie. interfaces defined by an infrastructure framework such as EJB).

I think its useful to extend that definition to prohibit POJOs from directly calling infrastructure framework APIs. Using this extended definition results in code that is decoupled from the infrastructure frameworks.

This has several benefits
* Its easier and faster to test - no waiting for the code to deploy or dependency on things that slow down testing such as a database
* Developers who have domain expertise but not infrastructure expertise can work on the code
* Your code is not impacted by rapidly evolving Java infrastructure frameworks some of which change incompatibly from one version to the next.

One interesting issue is whether POJOs with annotations are still POJOs. There is a case to be made that infrastructure framework-specific annotations introduces undesirable dependencies in the same way that implementing framework-specific interfaces does. (see http://www.aspectprogrammer.org/blogs/adrian/2004/08/when_is_a_pojo.html)

Chris
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When Java started off wasn't it all POJO's which you built your own classes. Then came the hoo-haa's about new frameworks and models which were supposed to "do everything" for the application developer. I am sure that these frameworks had its own advantages. People and corporations took these frameworks/ APIs and built a lot of applications/ services.

Now aren't we going multiple steps backwards in proclaiming POJO as the next "in" thing ?

To me, if I had written an application some 6 years ago and did NOT bother to follow the herd to convert my applications to be J2EE compliant, I am now in the world of POJOs !!! Correct me if I am wrong !

I believe after building all these complex blocks, we are claiming that "Oh! all these complexities are too much.. lets get back to the basics" Maybe there are benefits but isnt it turning the clock backwards ?
 
Chris Richardson
author
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Balan,

One way to look at the evolution of java frameworks:

0. No frameworks.

Your application code consists of a mixture busines logic + infrastructure logic (transactions, persistence etc) that you had to write yourself.

1. Invasive infrastructure frameworks such EJB 2.

The frameworks took care of the infrastructure issues (so you didn't have to write it yourself) but either (a) your classes had to implement special interfaces or (b) call framework APIs

2. Non-invasive frameworks/POJO-style programming

The frameworks still take care of infrastructure issues BUT very little of your code is coupled to those frameworks. For example, Spring provides transparent transaction management, Hibernate provides transparent persistence and only the small amount of DAO code has to call Hibernate APIs

Given all of the issues/benefits discussed previously I would claim that this is big step forward.

Chris
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure I understand what you are saying. EJB2 is an "Invasive Framework" because you have to implement special interfaces or call framework API's? I don't disagree with that statement, but not sure I have ever thought about it that way.

Thanks,
Eric
 
Eric Gero
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also meant to ask... Do you think the trend (for Sun) is to start moving away from invasive frameworks?

Thanks,
Eric
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for explaining about "Non-invasive frameworks/POJO-style programming". Always thought POJO is mere java without frameworks.
 
I'm not sure if I approve of this interruption. But this tiny ad checks out:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic