Cpp Cast interviews SemanticMerge team

Friday, December 21, 2018 0 Comments

I was invited to chat with the Cpp Cast crew, Rob Irving and Jason Turner – the best podcast on C++ development out on the interwebs. They wanted to know more about SemanticMerge, how it parses and merges C++ code and what this means for everyday programming in C++.

This is a short summary of our conversation on these and many other C++ topics such as the upcoming SD20 C++ teaching group or Alexander Boden's Cross-Platform framework.

A short story of SemanticMerge

SemanticMerge's was at the core of the version control system that gave birth to Códice Software in 2005. Merge tools sit at the foundations of any version control along with branching, changeset history and many other functionalities. If, I thought, Plastic SCM – the aforementioned version control – wanted to be a top-notch VCS then it should be powered by the highest quality merge tool we could design. Thus, developing a complete text-based merge algorithm was not enough, although the one we came up with, still provides considerable advantages over other syntactic tools. If we wanted to make a successful impact on the C++ programming language community our product should reduce the pain of frequent C++ code diffing and merging and enable shipping more code with better quality. In other words, that meant we needed to go a step further: into the forsaken realm of semantic merge.

Plastic SCM's first designs in 2005. Distributed repo management at its best already!
Plastic SCM's first designs in 2005. Distributed repo management at its best already!

Merging C++ code: the nightmare is over

Why not make our Merge Machine work on a function or on a method levels instead of just staying at a plain-text level? We designed it to diff the code on a structural level rather than on a text positioning level, our merge tool is able to connect the dots and actually trace changes inside methods or functions. So, basically if a method gets moved by programmer B and, at the same time, programmer A changes variables in that same method, SemanticMerge will be able to detect and merge both the positional change (syntactic level) and the structural change (semantic level). This is done creating, parsing, and diffing the ASTs and then figuring out via similarity algorithms if the text blocks of the different versions in the method are actually the same to proceed with the merge.

A byproduct of this approach is the number of manual merges that all of a sudden become automatic. Merging semantically reduces dramatically the number of undetected changes in the same method or, in other words, the number of "new" methods consequence of changes in their components just plummets, allowing for more automatic merges to happen and thus freeing productive time of C++ developers. This can even be performed across files! If the method used as an example is moved to a different file for the purpose of a refactor and changes are being done by another developer in the same method's original version, both can be diffed and merged by SemanticMerge.

The precision of SemanticMerge is such that indentation and spaces will be understood and it will react in consequence. It even provides the option to reformat the any given method before merging. This is the degree of precision that SemanticMerge is capable of, saving tons of time of otherwise manual, painstaking work.

C++ is by far the most complex of all the languages SemanticMerge supports (these include Java, C, C#, .NET...) but SemanticMerge uses Eclipse CDT project parser to parse C++ code, which is indeed of great help. This eventually results in 0 config requirements which at the end of the day is what end users really want from a merging tool, for it to work as soon as it is invoked.

Our suggestion is you read SemanticMerge's testimonials and you try it out yourselves. It is completely free for one whole month.

I would like to thank Rob and Jason for their time and their interest. If any of you would like to ask us anything about SemanticMerge please reach us out at:

https://twitter.com/semanticmerge

sales@codicesoftware.com

We develop Plastic SCM, a version control that excels in branching and merging, can deal with huge projects and big binary assets natively, and it comes with GUIs and tools to make everything simpler.

If you want to give it a try, download it from here.

We are also the developers of SemanticMerge, and the gmaster Git client.

0 comments: