SlideShare a Scribd company logo
1 of 27
Refactoring: Legacy
Who am I?
   Victor Polischuk
   A man with a terrible character.
   Java architect, team leader and coach.
   8+ years of software development experience.
   6+ years of Java experience.
   Have participated in 6+ legacy projects.
   Have seen numbers of them.
   Employed in Luxoft
What is...
 Short Name                        Description
The Highlander  Old, mature projects, had been written ages
                ago. Paragon.
Die Hard        Nobody knows why it is still alive.
Fashion Victims Nobody wants this sh%t anymore.
Problem Child   Nobody loves it.
Sentenced       Customer tired of supporting it, everything is up
                to you.
Apathetic       Nobody cares.
Rewrite or refactor?
What do we need...
1.A legacy project
2.A team of developers eager to refactor it.
3.A customer convinced enough to pay for it.
4.Smart tools (IDE, RegEx, File Manager etc.)
5.Open mind
Customer vs Developer
   Be Honest




   Be a Friend          Trust




    Do Care
Silly equals

 Budget + Time
                  =   Code + Time



   Ignorance
                  =      Risks



 Business Needs
                  =   Tech Needs
#1. Build procedure
    Target Oriented Model          Project Oriented Model
Each build script is unique     Every script looks like others
Low-level build instructions    High-level goals
No use of project information   Reuse of project information
Build flow or process issues    Predefined build flow
#2. Inversion of control



                    Reasons
  Reduce coupling.
  Increase testability.
  Makes further integration easier.
  Everybody use it.
Attach IoC library


   It is FREE!
XSLT
       Shell

               RegEx
 C#

       Etc
Java
                Python

         Etc

                   Etc
XSLT: Source
<struts-config>
…
<action-mappings>
…
<action path="/logon" type="example.LogonAction">
  <forward ... />
  <exception ... />
</action>

<action type="example.LogoutAction" path="/logout"/>
…
</action-mappings>
…
</struts-config>
XSLT: Template
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <beans>
     <xsl:apply-templates
                    select="struts-config/action-mappings/*"/>
  </beans>
</xsl:template>
<xsl:template match="action">
  <bean id="{@path}" class="{@type}"/>
</xsl:template>

</xsl:stylesheet>
XSLT: Result
<beans>
...
<bean id="/logon" class="example.LogonAction"/>
<bean id="/logout" class="example.LogoutAction"/>
...
</beans>
#3. Fortify defence line

New code     Wall      Old code
RegEx: Source
public class UserQuery {
...
public static User getUser(String userName) {…}

/** JavaDoc */
private static void doSomething(Object obj) {…}

/** JavaDoc */
public static void saveUser(User user) throws MagicError {…}
...
}
RegEx: Interface introduction
(?ms)(publics+statics+([^{]+).*?)(?=s+publics+|}s+z)



public class UserQuery {
...
User getUser(String userName);

void saveUser(User user) throws MagicError;
...
}
RegEx: Delegate methods 1
voids+(w+)s*(((?:(w+)s+(w+),?s*)+))s*;

void $1($2) {UserQuery.$1(<...>);}

public class UserDaoImpl implements UserDao {
...
User getUser(String userName);

void saveUser(User user) {UserQuery.saveUser(user);}
...
}
RegEx: Delegate methods 2
(w+)s+(w+)s*(((?:(w+)s+(w+),?s*)+))s*;

$1 $2($3) {return UserQuery.$2(<...>);}

public class UserDaoImpl implements UserDao {
...
User getUser(String userName) {
    return UserQuery.getUser(userName);
}

void saveUser(User user) {UserQuery.saveUser(user);}
...
}
Integration Steps
Attach IoC container.
Convert a couple of similar classes.
Develop a concept.
Share it with the team.
#4. Transaction management
        Programmatic                 Declarative
Full control                Limited control
Low scalability             High scalability
Noise in code               Clean code
High mistakes probability   Rare mistakes
Shall be only one ruler


   TransactionManager




begin    commit     rollback
Programmatic TM     Declarative TM


  begin           Data Access Tier


 commit             Service Tier


rollback          UI Controller Tier
Programmatic TM   Declarative TM


        begin      get


       commit


       rollback
Still Working?




Programmatic TM
Epilogue
   Do you really want it?


  Developer + Customer = Trust


              Just DO it


                Small steps


                   Problems only
XPDays Ukraine: Legacy

More Related Content

What's hot

What's hot (20)

Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy Code
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Tdd 왜 배우기 어려운가
Tdd 왜 배우기 어려운가Tdd 왜 배우기 어려운가
Tdd 왜 배우기 어려운가
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
Agile Programming Systems # TDD intro
Agile Programming Systems # TDD introAgile Programming Systems # TDD intro
Agile Programming Systems # TDD intro
 
Top 20 software testing interview questions for sdet
Top 20 software testing interview questions for sdetTop 20 software testing interview questions for sdet
Top 20 software testing interview questions for sdet
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
 
DevLabs Alliance Top 50 Selenium Interview Questions for SDET
DevLabs Alliance Top 50 Selenium Interview Questions for SDETDevLabs Alliance Top 50 Selenium Interview Questions for SDET
DevLabs Alliance Top 50 Selenium Interview Questions for SDET
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
Introduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed ShreefIntroduction to TDD (Test Driven development) - Ahmed Shreef
Introduction to TDD (Test Driven development) - Ahmed Shreef
 
Top 20 cucumber interview questions for sdet
Top 20 cucumber interview questions for sdetTop 20 cucumber interview questions for sdet
Top 20 cucumber interview questions for sdet
 
TDD & BDD
TDD & BDDTDD & BDD
TDD & BDD
 
Introduction to TDD and Mocking
Introduction to TDD and MockingIntroduction to TDD and Mocking
Introduction to TDD and Mocking
 
Test Automation and Keyword-driven testing af Brian Nielsen, CISS/AAU
Test Automation and Keyword-driven testing af Brian Nielsen, CISS/AAUTest Automation and Keyword-driven testing af Brian Nielsen, CISS/AAU
Test Automation and Keyword-driven testing af Brian Nielsen, CISS/AAU
 
The WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpecThe WHY behind TDD/BDD and the HOW with RSpec
The WHY behind TDD/BDD and the HOW with RSpec
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Adding Unit Test To Legacy Code
Adding Unit Test To Legacy CodeAdding Unit Test To Legacy Code
Adding Unit Test To Legacy Code
 
PHPUnit - Unit testing
PHPUnit - Unit testingPHPUnit - Unit testing
PHPUnit - Unit testing
 

Similar to XPDays Ukraine: Legacy

Similar to XPDays Ukraine: Legacy (20)

ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/Ops
 
How to Manage the Risk of your Polyglot Environments
How to Manage the Risk of your Polyglot EnvironmentsHow to Manage the Risk of your Polyglot Environments
How to Manage the Risk of your Polyglot Environments
 
So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016
 
Generative AI in CSharp with Semantic Kernel.pptx
Generative AI in CSharp with Semantic Kernel.pptxGenerative AI in CSharp with Semantic Kernel.pptx
Generative AI in CSharp with Semantic Kernel.pptx
 
DDD with Behat
DDD with BehatDDD with Behat
DDD with Behat
 
So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...
 
Python for Data Logistics
Python for Data LogisticsPython for Data Logistics
Python for Data Logistics
 
Apex triggers i
Apex triggers iApex triggers i
Apex triggers i
 
Architecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons LearnedArchitecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons Learned
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"
 
Dev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and FlickrDev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and Flickr
 
soa
soasoa
soa
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
Chhatarsha Singh
Chhatarsha SinghChhatarsha Singh
Chhatarsha Singh
 
An Introduction to Microservices
An Introduction to MicroservicesAn Introduction to Microservices
An Introduction to Microservices
 
How do we do it
How do we do itHow do we do it
How do we do it
 
Intro To AOP
Intro To AOPIntro To AOP
Intro To AOP
 

More from Victor_Cr

Jboss drools expert (ru)
Jboss drools expert (ru)Jboss drools expert (ru)
Jboss drools expert (ru)
Victor_Cr
 
JEEConf JBoss Drools
JEEConf JBoss DroolsJEEConf JBoss Drools
JEEConf JBoss Drools
Victor_Cr
 
JBoss Drools
JBoss DroolsJBoss Drools
JBoss Drools
Victor_Cr
 
Club of anonimous developers "Refactoring: Legacy code"
Club of anonimous developers "Refactoring: Legacy code"Club of anonimous developers "Refactoring: Legacy code"
Club of anonimous developers "Refactoring: Legacy code"
Victor_Cr
 

More from Victor_Cr (16)

Data Wars: The Bloody Enterprise strikes back
Data Wars: The Bloody Enterprise strikes backData Wars: The Bloody Enterprise strikes back
Data Wars: The Bloody Enterprise strikes back
 
Data Wars: The Bloody Enterprise strikes back
Data Wars: The Bloody Enterprise strikes backData Wars: The Bloody Enterprise strikes back
Data Wars: The Bloody Enterprise strikes back
 
Type War: Weak vs Strong [JEEConf 2016]
Type War: Weak vs Strong [JEEConf 2016]Type War: Weak vs Strong [JEEConf 2016]
Type War: Weak vs Strong [JEEConf 2016]
 
Types: Weak/Duck/Optional vs Strong/Strict. Let the War Begin!
Types: Weak/Duck/Optional vs Strong/Strict. Let the War Begin!Types: Weak/Duck/Optional vs Strong/Strict. Let the War Begin!
Types: Weak/Duck/Optional vs Strong/Strict. Let the War Begin!
 
Types: Weak/Duck/Optional vs Strong/Strict. Let the War Begin!
Types: Weak/Duck/Optional vs Strong/Strict. Let the War Begin!Types: Weak/Duck/Optional vs Strong/Strict. Let the War Begin!
Types: Weak/Duck/Optional vs Strong/Strict. Let the War Begin!
 
Legacy: как победить в гонке (Joker)
Legacy: как победить в гонке (Joker)Legacy: как победить в гонке (Joker)
Legacy: как победить в гонке (Joker)
 
Web-application I’ve always dreamt of (Kharkiv)
Web-application I’ve always dreamt of (Kharkiv)Web-application I’ve always dreamt of (Kharkiv)
Web-application I’ve always dreamt of (Kharkiv)
 
Web application I have always dreamt of (Lviv)
Web application I have always dreamt of (Lviv)Web application I have always dreamt of (Lviv)
Web application I have always dreamt of (Lviv)
 
Web application I have always dreamt of
Web application I have always dreamt ofWeb application I have always dreamt of
Web application I have always dreamt of
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the race
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the race
 
Jboss drools expert (ru)
Jboss drools expert (ru)Jboss drools expert (ru)
Jboss drools expert (ru)
 
JEEConf WEB
JEEConf WEBJEEConf WEB
JEEConf WEB
 
JEEConf JBoss Drools
JEEConf JBoss DroolsJEEConf JBoss Drools
JEEConf JBoss Drools
 
JBoss Drools
JBoss DroolsJBoss Drools
JBoss Drools
 
Club of anonimous developers "Refactoring: Legacy code"
Club of anonimous developers "Refactoring: Legacy code"Club of anonimous developers "Refactoring: Legacy code"
Club of anonimous developers "Refactoring: Legacy code"
 

Recently uploaded

FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
dollysharma2066
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
lizamodels9
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
 

Recently uploaded (20)

RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in indiaFalcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 
Value Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsValue Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and pains
 
Uneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration PresentationUneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration Presentation
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLJAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 

XPDays Ukraine: Legacy

  • 2. Who am I?  Victor Polischuk  A man with a terrible character.  Java architect, team leader and coach.  8+ years of software development experience.  6+ years of Java experience.  Have participated in 6+ legacy projects.  Have seen numbers of them.  Employed in Luxoft
  • 3. What is... Short Name Description The Highlander Old, mature projects, had been written ages ago. Paragon. Die Hard Nobody knows why it is still alive. Fashion Victims Nobody wants this sh%t anymore. Problem Child Nobody loves it. Sentenced Customer tired of supporting it, everything is up to you. Apathetic Nobody cares.
  • 5. What do we need... 1.A legacy project 2.A team of developers eager to refactor it. 3.A customer convinced enough to pay for it. 4.Smart tools (IDE, RegEx, File Manager etc.) 5.Open mind
  • 6. Customer vs Developer Be Honest Be a Friend Trust Do Care
  • 7. Silly equals Budget + Time = Code + Time Ignorance = Risks Business Needs = Tech Needs
  • 8. #1. Build procedure Target Oriented Model Project Oriented Model Each build script is unique Every script looks like others Low-level build instructions High-level goals No use of project information Reuse of project information Build flow or process issues Predefined build flow
  • 9. #2. Inversion of control Reasons Reduce coupling. Increase testability. Makes further integration easier. Everybody use it.
  • 10. Attach IoC library It is FREE!
  • 11. XSLT Shell RegEx C# Etc Java Python Etc Etc
  • 12. XSLT: Source <struts-config> … <action-mappings> … <action path="/logon" type="example.LogonAction"> <forward ... /> <exception ... /> </action> <action type="example.LogoutAction" path="/logout"/> … </action-mappings> … </struts-config>
  • 13. XSLT: Template <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <beans> <xsl:apply-templates select="struts-config/action-mappings/*"/> </beans> </xsl:template> <xsl:template match="action"> <bean id="{@path}" class="{@type}"/> </xsl:template> </xsl:stylesheet>
  • 14. XSLT: Result <beans> ... <bean id="/logon" class="example.LogonAction"/> <bean id="/logout" class="example.LogoutAction"/> ... </beans>
  • 15. #3. Fortify defence line New code Wall Old code
  • 16. RegEx: Source public class UserQuery { ... public static User getUser(String userName) {…} /** JavaDoc */ private static void doSomething(Object obj) {…} /** JavaDoc */ public static void saveUser(User user) throws MagicError {…} ... }
  • 17. RegEx: Interface introduction (?ms)(publics+statics+([^{]+).*?)(?=s+publics+|}s+z) public class UserQuery { ... User getUser(String userName); void saveUser(User user) throws MagicError; ... }
  • 18. RegEx: Delegate methods 1 voids+(w+)s*(((?:(w+)s+(w+),?s*)+))s*; void $1($2) {UserQuery.$1(<...>);} public class UserDaoImpl implements UserDao { ... User getUser(String userName); void saveUser(User user) {UserQuery.saveUser(user);} ... }
  • 19. RegEx: Delegate methods 2 (w+)s+(w+)s*(((?:(w+)s+(w+),?s*)+))s*; $1 $2($3) {return UserQuery.$2(<...>);} public class UserDaoImpl implements UserDao { ... User getUser(String userName) { return UserQuery.getUser(userName); } void saveUser(User user) {UserQuery.saveUser(user);} ... }
  • 20. Integration Steps Attach IoC container. Convert a couple of similar classes. Develop a concept. Share it with the team.
  • 21. #4. Transaction management Programmatic Declarative Full control Limited control Low scalability High scalability Noise in code Clean code High mistakes probability Rare mistakes
  • 22. Shall be only one ruler TransactionManager begin commit rollback
  • 23. Programmatic TM Declarative TM begin Data Access Tier commit Service Tier rollback UI Controller Tier
  • 24. Programmatic TM Declarative TM begin get commit rollback
  • 26. Epilogue Do you really want it? Developer + Customer = Trust Just DO it Small steps Problems only