Articles about extracting data from code, analyze it and programmatically transform it. In other words we talk about static analysis, automated refactoring, and code generation.

Code Generation

A Guide to Code Generation

There are many uses for Code Generation: We can generate repetitive code from schemas or source of information we have. For example, we can generate Data Access Objects from database schema files We can generate code from wizards We can generate skeletons of applications from simple models. We wrote about an example here: Code Generation […]

JArchitect: review of a tool to manage your Java project

JArchitect is a software to analyze Java projects. I think we need to use software to reason about software. As software developers we are building software to help other professionals in doing their job but still we rely not so much on software to help us in our work. We like the romantic ideas of […]

Complete Review of NDepend: Static Analysis For Software Architects

NDepend is a tool that helps .NET developers to write beautiful code This is a definition that does not come from the official documentation, but from a post on the blog of its developer. We like it because it is more interesting than the technical one: NDepend is a static analysis tool for .NET code […]

Recognize patterns in Java code to understand and transform applications

Code is arguably the most valuable asset for many organizations. However the value trapped in the code is not easy to use. Why? In this article we are going to see how we can extract and process knowledge in code by specifying patterns. We will see: A clear example of what we mean by extracting […]

Translate JavaScript to C#

Translate Javascript to C#

Let’s say you need to automatically port some code from one language to another, how are going to do it? Is it even possible? Maybe you have already seen a conversion between similar languages, such as Java to C#. That sounds much simpler in comparison. In this article we are going to discuss some strategies […]

Code Generation with Roslyn: a Skeleton Class from UML

Code Generation with Roslyn: a Skeleton Class from UML

We have already seen some examples of transformation and analysis of C# code with Roslyn. Now we are going to see how to create a more complex example of code generation with Roslyn and parsing with Sprache. We are going to create a skeleton class from a PlantUML file. In short, we are doing the […]

Code Climate: A service for static analysis

Code Climate: a Service for Static Analysis

GitHub has been a revolution for developers. You could consider SourceForge a predecessor, in the sense that it also let people share code. But GitHub it’s not simply a place where you can download programs, it’s mainly a platform for developers. One thing that GitHub has brought is integrations, of which there are many. The […]

Extracting JavaDoc documentation from source files using JavaParser

A lot of people are using JavaParser for the most different goals. One of these is extracting documentation. In this short post we will see how you can print all the JavaDoc comments associated to classes or interfaces. Code is available on GitHub: https://github.com/ftomassetti/javadoc-extractor Getting all the Javadoc comments for classes We are reusing DirExplorer, a supporting […]

Implementing Lexical Preservation for JavaParser

Many users of JavaParser are asking to implement lexical preservation, i.e., the ability of parsing a Java source file, modifying the AST and get back the modified Java source code keeping the original layout. Currently this is not supported by JavaParser: you can parse all Java 8 code with JavaParser, get an AST but then the […]

Observers for AST nodes in JavaParser

We are getting closer to the first Release Candidate for JavaParser 3.0. One of the last features we added was support for observing changes to all nodes of the Abstract Syntax Tree. While I wrote the code for this feature I received precious feedback from Danny van Bruggen (a.k.a. Matozoid) and Cruz Maximilien. So I […]