Contemporary Software Engineering Practices Together with Enterprise Java Technologies  Kenan Sevindik İnnova Bilişim A.Ş.
Software Engineering Problems <ul><li>Why so much spaghetti code is written? </li></ul><ul><li>“ If we had chance to rewri...
Prototyping Plan to Throw One Away (You Will Anyway) -- Brooks
Software Engineering Problems <ul><li>Broken Window Theory </li></ul><ul><li>Consider a building with a few broken windows...
Refactoring <ul><li>Technique for restructuring an existing body of code </li></ul><ul><li>Altering its internal structure...
Software Engineering Problems
Piecemeal Growth <ul><li>Russian Mir Space Station designed for </li></ul><ul><ul><li>Reconfiguration </li></ul></ul><ul><...
Why Master Plans Fail? <ul><li>They are often rigid, misguided, and out of date </li></ul><ul><li>Users need change with t...
Piecemeal Growth vs Large Lump Development <ul><li>Large-lump development is based on the idea of  replacement   </li></ul...
Piecemeal Growth vs Large Lump Development <ul><li>Piecemeal growth is  based on the healthier and more realistic view  th...
Agile Manifesto <ul><li>Highest priority is to satisfy the customer through  early and continuous delivery of valuable sof...
Agile Manifesto <ul><li>Build projects around  motivated individuals </li></ul><ul><li>The most efficient and effective me...
Agile Manifesto <ul><li>Continuous  attention to technical excellence  and good design enhances agility </li></ul><ul><li>...
Patterns in Architecture  <ul><li>“ A Pattern Language: Towns, Buildings, Construction </li></ul><ul><li>Writtern by Chris...
Patterns in Architecture
Patterns in Architecture <ul><li>Provides rules and pictures, and leaves decisions to be taken from the precise environmen...
Patterns in Architecture
Design Patterns: Elements of Reusable Object-Oriented Software  <ul><li>Influenced by “A Pattern Language: Towns, Building...
Question <ul><li>What is called for authors of this famous Design Patterns book? </li></ul><ul><li>Gang of Four </li></ul>
Design Patterns: Elements of Reusable Object-Oriented Software <ul><li>It describes  </li></ul><ul><ul><li>the  problem , ...
Question <ul><li>Where decorator pattern is used in JDK mostly? </li></ul><ul><li>java.io package </li></ul>
An Example: Decorator Pattern in Java IO Package <ul><li>Add new behaviours during runtime, without subclassing </li></ul>...
An Example: Decorator Pattern in Java IO Package Client LineNumber Reader FileReader read() read() maintainLineNumber()
An Example: Decorator Pattern in Java IO Package
Refactoring To Patterns <ul><li>Patterns are where you want to be; refactorings are ways to get there from somewhere else ...
Recommended Book <ul><li>Refactoring To Patterns </li></ul><ul><li>By Joshua Kerievsky </li></ul>
Test Driven Development <ul><li>Not a new idea at all </li></ul><ul><li>Since the dawn of computing, programmers specify i...
Test Driven Development <ul><li>J U nit  Testing Tool & Framework </li></ul><ul><li>Developed by Kent Beck and Erich Gamma...
“ No Time For Testing” Death Spiral Stress Write and Run Tests
Recommended Book <ul><li>Test Driven Development By Example </li></ul><ul><li>By Kent Beck </li></ul>
Test Driven Development and Continuous Refactoring <ul><li>Efficient evolution of working code by turning programming into...
Signs of Bad Design <ul><li>Rigidity </li></ul><ul><ul><li>It is  hard to change  a part in the system </li></ul></ul><ul>...
Signs of Bad Design <ul><li>Immobility </li></ul><ul><ul><li>It is  hard to reuse parts  in another application </li></ul>...
Object Oriented Principles <ul><li>Classes, methods , modules </li></ul><ul><li>Abstraction, Encapsulation, Inheritance, P...
Why Object Term Is Selected? <ul><li>Ben Kristen Nygaard'un önce ögrencisi sayilirim. Simdi &quot;Simula&quot; müzesine ka...
Object Oriented Principles <ul><li>Open-Closed Principle </li></ul><ul><li>Probably the most important OO principle </li><...
Object Oriented Principles <ul><li>The Single Responsibility Principle </li></ul><ul><li>There should  never be more than ...
Object Oriented Principles <ul><li>The Dependency Inversion Principle </li></ul><ul><li>Abstractions should not depend upo...
Aspect Oriented Programming <ul><li>Is object oriented programming sufficient to develop modular, well-encapsulated softwa...
Aspect Oriented Programming <ul><li>They are  scattered around  whole system </li></ul><ul><li>Cross cutting concerns    ...
Question <ul><li>What is the name of first and most popular AOP language for Java? </li></ul><ul><li>AspectJ </li></ul>
Recommended Book <ul><li>AspectJ in Action </li></ul><ul><li>By Ramnivas Laddad </li></ul>
Evolution of Enterprise Java <ul><li>J2SE, J2ME, J2EE </li></ul><ul><li>J2EE targets server side enterprise software devel...
Question <ul><li>When was Java first appeared? </li></ul><ul><li>In 1994 </li></ul>
Question <ul><li>What was Java’s previous name? </li></ul><ul><li>Oak </li></ul>
Evolution of Enterprise Java <ul><li>Layered Architectures </li></ul><ul><li>Enterprise Java Beans </li></ul><ul><li>Remot...
Evolution of Enterprise Java <ul><li>Trap of  One Size Fits All  Problem! </li></ul><ul><li>How many projects do require d...
Evolution of Enterprise Java <ul><li>J2EE is  driven by specifications  committee </li></ul><ul><li>It has its success, bu...
Evolution of Enterprise Java <ul><li>Appearence of  lightweight containers </li></ul><ul><li>Containers  should be  non-in...
Evolution of Enterprise Java <ul><li>They  applied best practices  learned over time </li></ul><ul><li>POJOs are in front ...
Recommended Book <ul><li>Patterns of Enterprise Application Architecture </li></ul><ul><li>By Martin Fowler et al </li></ul>
Spring Application Framework <ul><li>J2EE should be easier to use </li></ul><ul><li>Promote  program to interfaces     re...
Spring Application Framework <ul><li>JavaBeans offer great way of configuring applications </li></ul><ul><li>Testability i...
Spring Application Framework <ul><li>A layered Java/J2EE Application framework </li></ul><ul><li>Contains a lightweight co...
Spring Application Framework <ul><li>Provides AOP funcionality and close integration with AspectJ </li></ul><ul><ul><li>Yo...
Spring Application Framework <ul><li>Provides integration with several ORM tools, and JDBC mapping tools </li></ul><ul><ul...
Recommended Book <ul><li>Expert One-On-One J2EE Development Without EJB </li></ul><ul><li>By Rod Johnson and Juergen Hoell...
Hibernate OR Mapping Framework <ul><li>Persisting  data usually means  storing data in relational database  using SQL </li...
Hibernate OR Mapping Framework <ul><li>Relational databases provide a  tabular representation of persistent data </li></ul...
Object-Relational Paradigm Mismatch <ul><li>Different levels of granularity </li></ul><ul><ul><li>User-Address-zipcode in ...
Object-Relational Paradigm Mismatch User Address -street -no -zipcode BillingDetails -accountNumber CreditCard BankAccount...
Object-Relational Paradigm Mismatch <ul><li>Identity problem </li></ul><ul><ul><li>How to check whether two objects are id...
Object-Relational Paradigm Mismatch <ul><li>Association related problems </li></ul><ul><ul><li>Associations between object...
Object-Relational Paradigm Mismatch public class User { private Set billingDetails; ... } public class BillingDetails { pr...
Object-Relational Paradigm Mismatch <ul><li>The problem of data navigation </li></ul><ul><ul><li>Navigate from one object ...
Recommended Book <ul><li>Java Persistence with Hibernate </li></ul><ul><li>By Christian Bauer and Gaving King </li></ul>
Java Server Faces <ul><li>It is a web presentation framework </li></ul><ul><li>Based on MVC pattern </li></ul><ul><li>Cons...
Java Server Faces <ul><li>Event driven model in contrast to action based model in Struts </li></ul><ul><ul><li>Action even...
JSF MVC Model Model Renderer UI Component Listener Model View Controller
Conclusion <ul><li>Technology alone is not enough to develop quality software systems </li></ul><ul><li>Software engineeri...
Contact Info <ul><li>Kenan Sevindik </li></ul><ul><li>Work  : İnnova Bilişim A.Ş. </li></ul><ul><li>Blog  : http ://ksevin...
Upcoming SlideShare
Loading in …5
×

Contemporary Software Engineering Practices Together With Enterprise

1,757 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,757
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
28
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Contemporary Software Engineering Practices Together With Enterprise

    1. 1. Contemporary Software Engineering Practices Together with Enterprise Java Technologies Kenan Sevindik İnnova Bilişim A.Ş.
    2. 2. Software Engineering Problems <ul><li>Why so much spaghetti code is written? </li></ul><ul><li>“ If we had chance to rewrite this project, several things would be much different!” </li></ul>
    3. 3. Prototyping Plan to Throw One Away (You Will Anyway) -- Brooks
    4. 4. Software Engineering Problems <ul><li>Broken Window Theory </li></ul><ul><li>Consider a building with a few broken windows. If the windows are not repaired, the tendency is for vandals to break a few more windows. Eventually, they may even break into the building, and if it's unoccupied, perhaps become squatters or light fires inside. </li></ul>
    5. 5. Refactoring <ul><li>Technique for restructuring an existing body of code </li></ul><ul><li>Altering its internal structure without changing its external behavior </li></ul><ul><li>A series of small behavior preserving transformations </li></ul><ul><li>Each transformation does little, but a sequence of transformations can produce a significant restructuring </li></ul>
    6. 6. Software Engineering Problems
    7. 7. Piecemeal Growth <ul><li>Russian Mir Space Station designed for </li></ul><ul><ul><li>Reconfiguration </li></ul></ul><ul><ul><li>Modular growth </li></ul></ul><ul><li>Core module launched in 1986 </li></ul><ul><li>Until 1996 several modules were added and system was rearranged as it has grown </li></ul>Mir reenters the atmosphere over Fiji on 22 March, 2001
    8. 8. Why Master Plans Fail? <ul><li>They are often rigid, misguided, and out of date </li></ul><ul><li>Users need change with time </li></ul><ul><li>You can't simply plan, you have to plan to be able to adapt </li></ul>
    9. 9. Piecemeal Growth vs Large Lump Development <ul><li>Large-lump development is based on the idea of replacement </li></ul><ul><li>Piecemeal Growth is based on the idea of repair </li></ul><ul><li>Large-lump development is based on the fallacy that it is possible to build perfect buildings </li></ul>
    10. 10. Piecemeal Growth vs Large Lump Development <ul><li>Piecemeal growth is based on the healthier and more realistic view that mistakes are inevitable </li></ul><ul><li>Piecemeal growth is based on the assumption that adaptation between buildings and their users is necessarily a slow and continuous business </li></ul><ul><li>This adaptation cannot , under any circumstances, be achieved in a single leap </li></ul>
    11. 11. Agile Manifesto <ul><li>Highest priority is to satisfy the customer through early and continuous delivery of valuable software </li></ul><ul><li>Welcome changing requirements , even late in development </li></ul><ul><li>Deliver working software frequently </li></ul><ul><li>Business people and developers must work together daily </li></ul>
    12. 12. Agile Manifesto <ul><li>Build projects around motivated individuals </li></ul><ul><li>The most efficient and effective method of conveying information is face-to-face communication </li></ul><ul><li>Working software is the primary measure of progress </li></ul><ul><li>Agile processes promote sustainable development </li></ul>
    13. 13. Agile Manifesto <ul><li>Continuous attention to technical excellence and good design enhances agility </li></ul><ul><li>Simplicity- -the art of maximizing the amount of work not done-- is essential </li></ul><ul><li>The best architectures, requirements, and designs emerge from self-organizing teams </li></ul><ul><li>At regular intervals, the team reflects on how to become more effective </li></ul>
    14. 14. Patterns in Architecture <ul><li>“ A Pattern Language: Towns, Buildings, Construction </li></ul><ul><li>Writtern by Christopher Alexander in 1977 </li></ul><ul><li>Why many medieval cities are attractive and harmonious? </li></ul><ul><li>They were built to local regulations that required specific features, but freed the architect to adapt them to particular situations </li></ul>
    15. 15. Patterns in Architecture
    16. 16. Patterns in Architecture <ul><li>Provides rules and pictures, and leaves decisions to be taken from the precise environment of the project </li></ul><ul><li>Describes exact methods for constructing practical, safe and attractive designs at every scale </li></ul><ul><ul><li>from entire regions, </li></ul></ul><ul><ul><li>through cities, neighborhoods, gardens, buildings, rooms, built-in furniture </li></ul></ul>
    17. 17. Patterns in Architecture
    18. 18. Design Patterns: Elements of Reusable Object-Oriented Software <ul><li>Influenced by “A Pattern Language: Towns, Buildings, Construction </li></ul><ul><li>Written in 1994 </li></ul><ul><li>A catalog of 23 software design patterns </li></ul><ul><li>A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems. </li></ul>
    19. 19. Question <ul><li>What is called for authors of this famous Design Patterns book? </li></ul><ul><li>Gang of Four </li></ul>
    20. 20. Design Patterns: Elements of Reusable Object-Oriented Software <ul><li>It describes </li></ul><ul><ul><li>the problem , </li></ul></ul><ul><ul><li>the solution , </li></ul></ul><ul><ul><li>when to apply the solution , </li></ul></ul><ul><ul><li>and its consequences . </li></ul></ul><ul><li>It also gives </li></ul><ul><ul><li>implementation hints </li></ul></ul><ul><ul><li>and examples. </li></ul></ul><ul><li>The solution is a general arrangement of objects and classes that solve the problem. </li></ul><ul><li>The solution is customized and implemented to solve the problem in a particular context </li></ul>
    21. 21. Question <ul><li>Where decorator pattern is used in JDK mostly? </li></ul><ul><li>java.io package </li></ul>
    22. 22. An Example: Decorator Pattern in Java IO Package <ul><li>Add new behaviours during runtime, without subclassing </li></ul>java.lang. Object java.io. Reader java.io. InputStreamReader java.io. BufferedReader java.io. FileReader java.io. LineNumberReader
    23. 23. An Example: Decorator Pattern in Java IO Package Client LineNumber Reader FileReader read() read() maintainLineNumber()
    24. 24. An Example: Decorator Pattern in Java IO Package
    25. 25. Refactoring To Patterns <ul><li>Patterns are where you want to be; refactorings are ways to get there from somewhere else </li></ul><ul><li>Refactoring to, towards, and away from patterns, </li></ul><ul><li>Main reason programmers over-engineer is that they don't want to get stuck with a bad design </li></ul><ul><li>But over time, the power of patterns may lead to lose sight of simpler ways to write code </li></ul>
    26. 26. Recommended Book <ul><li>Refactoring To Patterns </li></ul><ul><li>By Joshua Kerievsky </li></ul>
    27. 27. Test Driven Development <ul><li>Not a new idea at all </li></ul><ul><li>Since the dawn of computing, programmers specify input & output before writing functionality </li></ul><ul><li>Consists of short iterations </li></ul><ul><ul><li>First write a test code which checks for new functionality or desired improvement </li></ul></ul><ul><ul><li>Then implement production code to make test code pass </li></ul></ul><ul><ul><li>Finally refactor software to accomodate changes for this new functionality or improvement </li></ul></ul>
    28. 28. Test Driven Development <ul><li>J U nit Testing Tool & Framework </li></ul><ul><li>Developed by Kent Beck and Erich Gamma </li></ul><ul><li>Test infected! </li></ul>
    29. 29. “ No Time For Testing” Death Spiral Stress Write and Run Tests
    30. 30. Recommended Book <ul><li>Test Driven Development By Example </li></ul><ul><li>By Kent Beck </li></ul>
    31. 31. Test Driven Development and Continuous Refactoring <ul><li>Efficient evolution of working code by turning programming into a dialogue: </li></ul><ul><li>Ask: You ask a question of a system by writing a test </li></ul><ul><li>Respond: You respond to the question by writing code to pass the test </li></ul><ul><li>Refine: You refine your response by consolidating ideas, weeding out inessentials, and clarifying ambiguities </li></ul><ul><li>Repeat: You keep the dialogue going by asking the next question </li></ul>
    32. 32. Signs of Bad Design <ul><li>Rigidity </li></ul><ul><ul><li>It is hard to change a part in the system </li></ul></ul><ul><ul><li>Every change affects too many other parts in the system </li></ul></ul><ul><li>Fragility </li></ul><ul><ul><li>When you make a change, unexpected parts of the system break </li></ul></ul>
    33. 33. Signs of Bad Design <ul><li>Immobility </li></ul><ul><ul><li>It is hard to reuse parts in another application </li></ul></ul><ul><ul><li>It cannot be disentangled from the current application </li></ul></ul><ul><li>Viscosity </li></ul><ul><ul><li>When faced with a change, engineers usually find more than one way to make the change </li></ul></ul><ul><ul><li>Some of the ways preserve the design, others do not (they are hacks!) </li></ul></ul><ul><ul><li>When the design preserving methods are harder to employ than the hacks , then the viscosity of the design is high </li></ul></ul><ul><ul><li>It is easy to do the wrong thing, but hard to do the right thing </li></ul></ul>
    34. 34. Object Oriented Principles <ul><li>Classes, methods , modules </li></ul><ul><li>Abstraction, Encapsulation, Inheritance, Polymorphism </li></ul><ul><li>Are they really enough to develop quality OO software? </li></ul><ul><li>They are atomic units , we need much coarse-grained elements </li></ul>
    35. 35. Why Object Term Is Selected? <ul><li>Ben Kristen Nygaard'un önce ögrencisi sayilirim. Simdi &quot;Simula&quot; müzesine kaldirilan bir kara (aslinda yesil) tahtamiz vardi, onun önünde böyle seyleri günlerce tartisirdik. Nesne object gibi ama &quot; material &quot; olma özelligini ima ediyor. Object kelimesinin arkasinda yatan orijinal fikir &quot; individual &quot; ve &quot; identifiable &quot; olmasi idi, ama terimin bilincli bir sekilde &quot;ting&quot; olarak secilmemesinin ana nedeni kavramlari kapsamamasi idi. Bir de object'in &quot; process &quot; (sürec, sadece aktivite tanimi) kavramina kontrast olarak secildigini de hatirlamak gerekir. Kristen Nygaard'un Ole Johan Dahl (yani Simula ve OO kavramlarinin &quot;formalisti&quot;) ile tartismalarindan su cümleyi cok iyi hatirliyorum: Bu &quot;sey&quot; hem fiziki hem kavramsal seyleri temsil edebilmeli. Kendisi sürec'e alternatif olmali ama bir süreci de temsil edebilmeli. Ingilizcedeki tanimimiz &quot; a structural and behavioral representation of a conceptual or physical entity, identifiable as a separate individual entity &quot;. </li></ul><ul><li>Hatta &quot;object&quot; kelimesinin (ki Norveccesi de ayni, Objekt) seciminde bir bireye &quot; odaklanma &quot; ( focus ) yan anlami da önemli: </li></ul><ul><li>Programlama (ki o zaman Simula ve OO sadece simulasyon programlamak icin düsünülüyordu) cevreyi kavramsallastirmak, modellemek ile baslar, ve bu modelde nelere odaklanacak, neler model disi birakilacak bu da cok önemli (denirdi). Dolayisiyla objekt'ler model üniteleri olarak da &quot; object of attention &quot;, yani secilip üzerine odaklanan objectler olarak da düsünülürdü. Ayrica &quot; object &quot;in &quot; subject &quot;ten faki, yani kavramsal da olsa &quot; dissal &quot; bir seyin temsili oldugu da kelimenin seciminde rol oynadi. Tabii daha benim bildigim ve bilmedigim 1000 cesit tartisma oldu bu konuda, ama sanirim tartismalarin tarzinda modelleme ünitesinin özellikleri yatiyordu hep. Bunlar felsefi (ve tarihi) tartismalar belki ama tartismalarin altinda dilin ne derece düsünmeye yardimci olabilecegi veya engelleyebilecegi hipotezi yatiyor ( Sapir-Whorf thesis ). Nesne bu kavramlari temsil ediyormu (kognitif olarak, yani otomatik bunu mu algiliyor insanlar &quot;nesne&quot; kelimesini duyduklarinda)? Degilse, bu kavramlari toplayan ve &quot; icgüdüsel &quot; temsil eden Türkce kelime nedir? Object'in Türkce cevirisindeki tartismalara aranizda sahit olan varmi? Bilmek isterdim. </li></ul><ul><ul><ul><ul><ul><li>Naci Akkök 29.08.2003 </li></ul></ul></ul></ul></ul>
    36. 36. Object Oriented Principles <ul><li>Open-Closed Principle </li></ul><ul><li>Probably the most important OO principle </li></ul><ul><li>Software entities should be open for extension but closed for modification </li></ul><ul><li>When requirements change, you extend available behaviour, not change old code that already works </li></ul>
    37. 37. Object Oriented Principles <ul><li>The Single Responsibility Principle </li></ul><ul><li>There should never be more than one reason for a class to change </li></ul><ul><li>Responsibility  reason to change </li></ul>
    38. 38. Object Oriented Principles <ul><li>The Dependency Inversion Principle </li></ul><ul><li>Abstractions should not depend upon details </li></ul><ul><li>Details should depend upon abstractions </li></ul><ul><li>Layering and abstract layers </li></ul><ul><li>Concrete classes should depend upon those abstract layers </li></ul>
    39. 39. Aspect Oriented Programming <ul><li>Is object oriented programming sufficient to develop modular, well-encapsulated software systems? </li></ul><ul><li>OOP supports encapsulation of concerns (interests of focus) to some degree </li></ul><ul><li>Some concerns simply cannot exist in one seperate module </li></ul>
    40. 40. Aspect Oriented Programming <ul><li>They are scattered around whole system </li></ul><ul><li>Cross cutting concerns  they &quot;cut&quot; across multiple modules in a program </li></ul><ul><li>AOP provides some way to encapsulate cross-cutting concerns in one place </li></ul>
    41. 41. Question <ul><li>What is the name of first and most popular AOP language for Java? </li></ul><ul><li>AspectJ </li></ul>
    42. 42. Recommended Book <ul><li>AspectJ in Action </li></ul><ul><li>By Ramnivas Laddad </li></ul>
    43. 43. Evolution of Enterprise Java <ul><li>J2SE, J2ME, J2EE </li></ul><ul><li>J2EE targets server side enterprise software development </li></ul><ul><li>First J2EE version dates back to 1998 </li></ul>
    44. 44. Question <ul><li>When was Java first appeared? </li></ul><ul><li>In 1994 </li></ul>
    45. 45. Question <ul><li>What was Java’s previous name? </li></ul><ul><li>Oak </li></ul>
    46. 46. Evolution of Enterprise Java <ul><li>Layered Architectures </li></ul><ul><li>Enterprise Java Beans </li></ul><ul><li>Remote Method Invocations </li></ul><ul><li>Distributed Transactions </li></ul><ul><li>Big monolitic application servers </li></ul>
    47. 47. Evolution of Enterprise Java <ul><li>Trap of One Size Fits All Problem! </li></ul><ul><li>How many projects do require distributed transactions? </li></ul><ul><li>Why so much complexity with EJBs?, we only need to insert, delete, and update records in our database. </li></ul><ul><li>Can’t we run our application outside any application server? </li></ul>
    48. 48. Evolution of Enterprise Java <ul><li>J2EE is driven by specifications committee </li></ul><ul><li>It has its success, but drawbacks as well </li></ul><ul><li>Enterprise Java community learned much from their failures </li></ul><ul><li>Return back to POJO driven development </li></ul><ul><li>Apply techniques which have been proven in the battlefield! </li></ul>
    49. 49. Evolution of Enterprise Java <ul><li>Appearence of lightweight containers </li></ul><ul><li>Containers should be non-invasive </li></ul><ul><li>Applications can be run anywhere </li></ul><ul><li>You don’t have to use EJBs to develop enterprise Java applications </li></ul><ul><li>There appeared successful open source technologies alternative to J2EE standards </li></ul>
    50. 50. Evolution of Enterprise Java <ul><li>They applied best practices learned over time </li></ul><ul><li>POJOs are in front </li></ul><ul><li>Testability is favored </li></ul><ul><li>Dependency Inversion Principle is rediscovered </li></ul>
    51. 51. Recommended Book <ul><li>Patterns of Enterprise Application Architecture </li></ul><ul><li>By Martin Fowler et al </li></ul>
    52. 52. Spring Application Framework <ul><li>J2EE should be easier to use </li></ul><ul><li>Promote program to interfaces  remember dependency inversion principle </li></ul><ul><li>Use of ordinary Java objects fostered whenever possible  POJO driven development </li></ul><ul><li>OO design is more important than any implementation technology, such as J2EE </li></ul>
    53. 53. Spring Application Framework <ul><li>JavaBeans offer great way of configuring applications </li></ul><ul><li>Testability is essential, any framework should help make your code easier to test </li></ul><ul><li>Don’t compete with existing good solutions , but foster integration with them </li></ul>
    54. 54. Spring Application Framework <ul><li>A layered Java/J2EE Application framework </li></ul><ul><li>Contains a lightweight container </li></ul><ul><ul><li>POJOs are configured and managed within this environment </li></ul></ul><ul><ul><li>Promotes development of loosely-coupled components </li></ul></ul><ul><ul><li>Components can be developed and tested in isolation, and then can be deployed in any environment (Java/JEE) </li></ul></ul>
    55. 55. Spring Application Framework <ul><li>Provides AOP funcionality and close integration with AspectJ </li></ul><ul><ul><li>You can AOP enable any object managed by Spring </li></ul></ul><ul><ul><li>Even you can apply your aspects to non Spring managed code! </li></ul></ul><ul><li>Provides a common abstraction layer for transaction management </li></ul><ul><ul><li>You can have declerative TX management without EJBs </li></ul></ul><ul><ul><li>You don’t need J2EE servers to have transaction support </li></ul></ul>
    56. 56. Spring Application Framework <ul><li>Provides integration with several ORM tools, and JDBC mapping tools </li></ul><ul><ul><li>Toplink, Hibernate, iBatis SQL Maps </li></ul></ul><ul><li>It has is own web MVC framework, provides integration with other popular web frameworks, like Struts, JSF etc </li></ul><ul><li>Support for Security, Remoting, Web Services... </li></ul>
    57. 57. Recommended Book <ul><li>Expert One-On-One J2EE Development Without EJB </li></ul><ul><li>By Rod Johnson and Juergen Hoeller </li></ul>
    58. 58. Hibernate OR Mapping Framework <ul><li>Persisting data usually means storing data in relational database using SQL </li></ul><ul><li>In an OO application, persistence allows an object to outlive the process that created it </li></ul><ul><li>State of the object can be stored to disk , and an object with the same state can be re-created at some point in the future </li></ul>
    59. 59. Hibernate OR Mapping Framework <ul><li>Relational databases provide a tabular representation of persistent data </li></ul><ul><li>An application with a domain model doesn’t work directly with the tabular representation of the business entities </li></ul><ul><li>Object-relational paradigm mismatch </li></ul>
    60. 60. Object-Relational Paradigm Mismatch <ul><li>Different levels of granularity </li></ul><ul><ul><li>User-Address-zipcode in domain model </li></ul></ul><ul><ul><li>User table and address_zipcode column in relational model </li></ul></ul><ul><li>Problem of subtypes </li></ul><ul><ul><li>Inheritance in Java is type inheritance </li></ul></ul><ul><ul><li>Tables in relational model doesn’t represent types </li></ul></ul><ul><ul><li>Support for polymorphic associations and queries </li></ul></ul>
    61. 61. Object-Relational Paradigm Mismatch User Address -street -no -zipcode BillingDetails -accountNumber CreditCard BankAccount 1..* 1 create table USERS ( USERNAME varchar(15) not null primary key, NAME varchar(50) not null, ADDRESS varchar(100) ) create table BILLING_DETAILS ( ACCOUNT_NUMBER varchar(10) not null primary key, ACCOUNT_NAME varchar(50) not null, ACCOUNT_TYPE varchar(2) not null, USERNAME varchar(15) foreign key references user )
    62. 62. Object-Relational Paradigm Mismatch <ul><li>Identity problem </li></ul><ul><ul><li>How to check whether two objects are identical? </li></ul></ul><ul><ul><li>Java has two ways for this </li></ul></ul><ul><ul><ul><li>Object identity a==b </li></ul></ul></ul><ul><ul><ul><li>Equals() check  equality by value </li></ul></ul></ul><ul><ul><li>Primary keys are used in database table </li></ul></ul>
    63. 63. Object-Relational Paradigm Mismatch <ul><li>Association related problems </li></ul><ul><ul><li>Associations between objects are directional </li></ul></ul><ul><ul><li>Object references </li></ul></ul><ul><ul><li>Foreign keys are used in databases, not directional </li></ul></ul><ul><ul><li>There are many-to-many associations in object models </li></ul></ul><ul><ul><li>Only one-to-many and one-to-one associations exist in relational model </li></ul></ul>
    64. 64. Object-Relational Paradigm Mismatch public class User { private Set billingDetails; ... } public class BillingDetails { private User user; ... } USER_ID bigint foreign key references USERS USER_ID bigint unique foreign key references USERS BILLING_DETAILS_ID bigint primary key foreign key references USERS
    65. 65. Object-Relational Paradigm Mismatch <ul><li>The problem of data navigation </li></ul><ul><ul><li>Navigate from one object to other using object references </li></ul></ul><ul><ul><li>You need to determine navigation path before walking on it in relational model </li></ul></ul><ul><ul><ul><li>Joins </li></ul></ul></ul><ul><ul><li>In object model you access deeper level objects only when you need them </li></ul></ul><ul><ul><ul><li>Select N+1 problem in relational model </li></ul></ul></ul><ul><ul><ul><li>Or bring too much data into memory </li></ul></ul></ul>
    66. 66. Recommended Book <ul><li>Java Persistence with Hibernate </li></ul><ul><li>By Christian Bauer and Gaving King </li></ul>
    67. 67. Java Server Faces <ul><li>It is a web presentation framework </li></ul><ul><li>Based on MVC pattern </li></ul><ul><li>Consists of </li></ul><ul><ul><li>User interface component model </li></ul></ul><ul><ul><li>Well defined request processing life-cycle </li></ul></ul><ul><li>Suitable for web sites where a lot of user interaction occurs </li></ul>
    68. 68. Java Server Faces <ul><li>Event driven model in contrast to action based model in Struts </li></ul><ul><ul><li>Action events </li></ul></ul><ul><ul><li>Value changed events </li></ul></ul><ul><ul><li>Selection events </li></ul></ul><ul><li>Possible to develop reusable UI components </li></ul>
    69. 69. JSF MVC Model Model Renderer UI Component Listener Model View Controller
    70. 70. Conclusion <ul><li>Technology alone is not enough to develop quality software systems </li></ul><ul><li>Software engineering concepts, methods and practices need concrete application area to evolve </li></ul><ul><li>Tend in Enterprise Java world is towards much agile and adaptable systems </li></ul>
    71. 71. Contact Info <ul><li>Kenan Sevindik </li></ul><ul><li>Work : İnnova Bilişim A.Ş. </li></ul><ul><li>Blog : http ://ksevindik.blogspot.com </li></ul><ul><li>E-Mail : [email_address] </li></ul>

    ×