SlideShare une entreprise Scribd logo
1  sur  28
No fear refactoring in the DVCS age

Enter SemanticMerge
pablo santos @psluaces
@semanticmerge

meet us at booth #14
Agenda
• How to diff and merge refactored code with
SemanticMerge
• Under the hood: the inner workings of the tool
• Next step: multi-file SemanticMerge
• Towards Semantic version control
Tech from the 80’s
• Git and the DVCS pack came in 2005
• They went mainstream (GitHub)
• They all can do awesome merges
• But they rely on old-fashioned diff and merge tools
You can do amazing things with DVCS
You can do amazing things with DVCS
• It has greatly improved merge tracking
• It does a great job finding the contributors for the 3-way
merge
• But at the end of the day… it invokes an external 3-way
merge tool to solve the merge
Simple example
Simple example
Simple example
What will a conventional 3-way merge tool do?
• No conflict!
• And two methods!!
What will a conventional 3-way merge tool do?
• No conflict!
• And two methods!!
• It simply finds two blocks of text
being added and the original
block being deleted… Doesn’t
care about the code structure
What SemanticMerge does
• It *knows* about the methods so…
What is
semanticmerge?
I guess you all know by now ;-)

• It is a 3-way merge tool (handles src, dst and base).
• It is refactor-aware and programming languageaware.
• Handles merging at the structure level and not
textblock level.
• It means:
• It first parses the code – creates intermediate trees.
• Then calculates diff pairs: base-src, base-dst.
• Then looks for conflicts between pairs.

• Enabling eXtreme Refactoring was always the goal :-)
How can
semanticmerge affect
development?
We were always motivated by “the cost of
change” and how refactoring can greatly
help keeping code quality high and reducing
maintenance costs.
SemanticMerge is all about helping teams to
clean up the code, keep it readable and
simple, without restrictions: do it in
parallel, fine!
How can
semanticmerge affect
development?
1) It helps simplifying the merges TODAY
already.
2) But more importantly it enables new
scenarios that you’re not doing today: clean
up the code, move methods, split classes…
and just be able to merge it back.
A SemanticMerge scenario
A divergent move case
Detect conflicts that regular tools can’t
• What if the same method is modified concurrently at
different lines?
• Semantic detects the case and can force the conflict
resolution to be manual – a regular text based merge tool can’t do that
because it doesn’t have the context
Under the hood
Creating a tree-like view of the code
using System [1]
using System.Text [2]
namespace Sample [4-26]
class Math [6-25]
int Add(int a, int b) [8-12]
int Mul(int a, int b) [14-18]
int Subst(int a, int b) [20-24]
base

source

destination

Process
Parser

source tree

base tree

destination tree

Differ

Differ

src-base diffs

dst-base diffs

Merger
automatic conflicts
manual conflicts
source ops to apply

result
Some complex cases – cyclic move
base

namespace Test
class Socket
class Utils

class DNS

namespace Test
class DNS
class Socket

class Utils

source

namespace Test
class Socket
class Utils

class DNS

destination
Evil twin

base

namespace Test
class Socket
method Connect

source
destination

namespace Test

namespace Test

class Socket

class Socket
method Connect

method Connect

method Send

method Send

Two methods with exactly the same
signature can’t be added on the same
location -> conflict
Integrations
• IntelliJ (and Android Studio)
• Git, Mercurial, TFS, Plastic SCM, Perforce, SVN…
everything!
Next steps
Check UserVoice -

http://plasticscm.uservoice.com

• JavaScript is the top request
• C/C++ - Objective-C
• XML
• Ruby, Scala…
• Mac OS X support
• External Parsers (Delphi already there)
• Semantic code review – each time you
Next steps

review code you would like to go straight to the point…

• Semantic blame/annotate – calculate
the blame considering methods

• Semantic Method History
• Semantic repository stats
Multi-file
SemanticMerge
Semantic Merge - No fear refactoring

Contenu connexe

Similaire à Semantic Merge - No fear refactoring

Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?Jordi Cabot
 
Data Science Accelerator Program
Data Science Accelerator ProgramData Science Accelerator Program
Data Science Accelerator ProgramGoDataDriven
 
Improving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeImproving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeJohan Carlin
 
Moving to Microservices with the Help of Distributed Traces
Moving to Microservices with the Help of Distributed TracesMoving to Microservices with the Help of Distributed Traces
Moving to Microservices with the Help of Distributed TracesKP Kaiser
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentMitosis Technology
 
Excavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsExcavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsUwe Friedrichsen
 
Software engineering principles (marcello thiry)
Software engineering principles (marcello thiry)Software engineering principles (marcello thiry)
Software engineering principles (marcello thiry)Marcello Thiry
 
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to ThemingTara King
 
How to build the perfect pattern library
How to build the perfect pattern libraryHow to build the perfect pattern library
How to build the perfect pattern libraryWolf Brüning
 
Workshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfWorkshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfTobiasGoeschel
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018Mike Harris
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2Ankit Dubey
 
Git Makes Me Angry Inside - DrupalCon Prague
Git Makes Me Angry Inside - DrupalCon PragueGit Makes Me Angry Inside - DrupalCon Prague
Git Makes Me Angry Inside - DrupalCon PragueEmma Jane Hogbin Westby
 

Similaire à Semantic Merge - No fear refactoring (20)

Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?
 
The Modlet Pattern
The Modlet PatternThe Modlet Pattern
The Modlet Pattern
 
Data Science Accelerator Program
Data Science Accelerator ProgramData Science Accelerator Program
Data Science Accelerator Program
 
Refactoring 2 The Max
Refactoring 2 The MaxRefactoring 2 The Max
Refactoring 2 The Max
 
Improving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeImproving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis code
 
Hadoop bank
Hadoop bankHadoop bank
Hadoop bank
 
Moving to Microservices with the Help of Distributed Traces
Moving to Microservices with the Help of Distributed TracesMoving to Microservices with the Help of Distributed Traces
Moving to Microservices with the Help of Distributed Traces
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software development
 
Vba Class Level 3
Vba Class Level 3Vba Class Level 3
Vba Class Level 3
 
Excavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsExcavating the knowledge of our ancestors
Excavating the knowledge of our ancestors
 
Software engineering principles (marcello thiry)
Software engineering principles (marcello thiry)Software engineering principles (marcello thiry)
Software engineering principles (marcello thiry)
 
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
2013 Twin Cities Drupal Camp - No CSS Needed: A Sitebuilders' Guide to Theming
 
How to build the perfect pattern library
How to build the perfect pattern libraryHow to build the perfect pattern library
How to build the perfect pattern library
 
Workshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfWorkshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdf
 
Modular plugins
Modular pluginsModular plugins
Modular plugins
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
Git Makes Me Angry Inside - DrupalCon Prague
Git Makes Me Angry Inside - DrupalCon PragueGit Makes Me Angry Inside - DrupalCon Prague
Git Makes Me Angry Inside - DrupalCon Prague
 

Dernier

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Dernier (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Semantic Merge - No fear refactoring

  • 1.
  • 2. No fear refactoring in the DVCS age Enter SemanticMerge pablo santos @psluaces @semanticmerge meet us at booth #14
  • 3. Agenda • How to diff and merge refactored code with SemanticMerge • Under the hood: the inner workings of the tool • Next step: multi-file SemanticMerge • Towards Semantic version control
  • 4. Tech from the 80’s • Git and the DVCS pack came in 2005 • They went mainstream (GitHub) • They all can do awesome merges • But they rely on old-fashioned diff and merge tools
  • 5. You can do amazing things with DVCS
  • 6. You can do amazing things with DVCS • It has greatly improved merge tracking • It does a great job finding the contributors for the 3-way merge • But at the end of the day… it invokes an external 3-way merge tool to solve the merge
  • 10. What will a conventional 3-way merge tool do? • No conflict! • And two methods!!
  • 11. What will a conventional 3-way merge tool do? • No conflict! • And two methods!! • It simply finds two blocks of text being added and the original block being deleted… Doesn’t care about the code structure
  • 12. What SemanticMerge does • It *knows* about the methods so…
  • 13. What is semanticmerge? I guess you all know by now ;-) • It is a 3-way merge tool (handles src, dst and base). • It is refactor-aware and programming languageaware. • Handles merging at the structure level and not textblock level. • It means: • It first parses the code – creates intermediate trees. • Then calculates diff pairs: base-src, base-dst. • Then looks for conflicts between pairs. • Enabling eXtreme Refactoring was always the goal :-)
  • 14. How can semanticmerge affect development? We were always motivated by “the cost of change” and how refactoring can greatly help keeping code quality high and reducing maintenance costs. SemanticMerge is all about helping teams to clean up the code, keep it readable and simple, without restrictions: do it in parallel, fine!
  • 15. How can semanticmerge affect development? 1) It helps simplifying the merges TODAY already. 2) But more importantly it enables new scenarios that you’re not doing today: clean up the code, move methods, split classes… and just be able to merge it back.
  • 18. Detect conflicts that regular tools can’t • What if the same method is modified concurrently at different lines? • Semantic detects the case and can force the conflict resolution to be manual – a regular text based merge tool can’t do that because it doesn’t have the context
  • 20. Creating a tree-like view of the code using System [1] using System.Text [2] namespace Sample [4-26] class Math [6-25] int Add(int a, int b) [8-12] int Mul(int a, int b) [14-18] int Subst(int a, int b) [20-24]
  • 21. base source destination Process Parser source tree base tree destination tree Differ Differ src-base diffs dst-base diffs Merger automatic conflicts manual conflicts source ops to apply result
  • 22. Some complex cases – cyclic move base namespace Test class Socket class Utils class DNS namespace Test class DNS class Socket class Utils source namespace Test class Socket class Utils class DNS destination
  • 23. Evil twin base namespace Test class Socket method Connect source destination namespace Test namespace Test class Socket class Socket method Connect method Connect method Send method Send Two methods with exactly the same signature can’t be added on the same location -> conflict
  • 24. Integrations • IntelliJ (and Android Studio) • Git, Mercurial, TFS, Plastic SCM, Perforce, SVN… everything!
  • 25. Next steps Check UserVoice - http://plasticscm.uservoice.com • JavaScript is the top request • C/C++ - Objective-C • XML • Ruby, Scala… • Mac OS X support • External Parsers (Delphi already there)
  • 26. • Semantic code review – each time you Next steps review code you would like to go straight to the point… • Semantic blame/annotate – calculate the blame considering methods • Semantic Method History • Semantic repository stats