2015年10月2日 星期五

[java] 什麼是 POJO


關於 POJO 在裡有個很好的解釋


"We wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely."--Martin Fowler

我們疑惑為什麼人們不喜歡在他們的系統中使用普通的對象,我們得到的結論是——普通的對象缺少一個響亮的名字,因此我們給它們起了一個,並且取得了很好的效果。 ——Martin Fowler

"An acronym for: Plain Old Java Object.
The term was coined while Rebecca Parsons, Josh MacKenzie and I were preparing for a talk at a conference in September 2000. In the talk we were pointing out the many benefits of encoding business logic into regular java objects rather than using Entity Beans. We wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely."


其實 POJO ,就是一個 Plain Old Java Object,一個 regular java objects 

至於 Entity Beans 是  a remote object that manages persistent data, performs complex business logic, potentially uses several dependent Java objects, and can be uniquely identified by a primary key.



POJO_百度百科
http://baike.baidu.com/item/POJO

這裡有另外一篇,更不錯的解釋:
java - How to create a POJO? - Stack Overflow
http://stackoverflow.com/questions/3527264/how-to-create-a-pojo


沒有留言:

張貼留言