JavaRush/Java Blog/Random EN/How an interview test turned into an open-source library

How an interview test turned into an open-source library

Published in the Random EN group
members
Hello everyone, JavaRush community! A little about myself: I have been working as a Java Software Engineer since the spring of 2016. I love coming here and solving problems that I didn’t solve during my studies. Today I’ll tell you about the library - Image Comparison . This is an open source library that is publicly available on GitHub . How an interview test task turned into an open-source library - 1The purpose of this article is to convey that creating an open source product is not just a waste of time, no! This is a rich experience that is drawn from different sides, when you have control over the entire development process, when you need to delve into every detail. Open Source is the world around you. I'm not kidding, during the existence of this library, I communicated with people from different countries, such as the USA, India, China, Egypt, Russia, Germany, Ukraine, Sweden, New Zealand, Norway. That is, this is real experience in joint development, finding compromises, checking code, and so on. That was the introduction, now let's start in order:

Test. Beginning of August 2017

It all started with the fact that I had an interview with one of the companies, where the first step was to write a test task. The task was to write a code that would compare two pictures of the same size, find the differences between them, group them and draw a rectangle around them. There is the first picture:
How an interview test task turned into an open-source library - 2
There is a second picture:
How an interview test task turned into an open-source library - 3
It was necessary to find the differences and circle them as shown below:
How an interview test task turned into an open-source library - 4
As you can see, there is a difference in the Username field , which is circled with a red triangle. More detailed description of the task . I decided that I wanted to do it not only correctly from a functional point of view, but also beautifully, so that it would not be embarrassing. To do this, I decided that I would publish this as a project on GitHub . I have long wanted to study GitHub and gain experience working with it. After a quick look, I found that it would be good to add third-party services for analyzing code quality, generating code coverage with tests, etc. Added the following tools:
  • Codacy - code quality. It's really worth paying attention to.

  • Travis CI is a CI (continuous integration) tool that builds a project, runs tests and tells whether the project was built successfully. For example, if one of the tests did not pass as a result of the new changes, then it will say that the project build was unsuccessful and will color it red.

  • Coveralls is a tool that shows what percentage of your code is covered by tests.

  • BetterCode Hub is another tool for analyzing code quality. A very useful thing that will not only tell you what is bad, but also describe why and give a link to a book where you can gain knowledge about it.

Each of these services has its own badge with data results, such as a code coverage project. And this badge can be added in the main description of the project - README file. The task was ready - I sent it for review. After the review, I immediately, from fresh memory, created a Github Issue for each comment , which would then help me improve this project. There was no improvement task from the employer, so I forgot about the project for a while...

Library Path. July 2018

Logo

At one point, I discovered that people often visit my project, and this happens every day. I was amazed by this, and even more amazed by the fact that about a year later they created an ISSUE, in which it was written that a certain graphic designer was offering me to create a logo for my project. They say he loves to do this for Opensource products and will do it absolutely free. We started collaborating. Several options were proposed, but ultimately we settled on this:
How an interview test task turned into an open-source library - 5
I was still young then and unfamiliar with the opensource community, and the very fact of such an offer was wild to me and I asked, why is he doing this? To which he replied: “Lolz oh, just cause i love contributing to open source projects. Kind of a life goals thing...” ( the issue itself is here ). That’s when I first felt how great it is when different people find you through open source projects and offer such interesting things!

First Side Defect

I noticed that a certain developer from China created an issue for me , in which he described that he had found a defect in the work of the library, that if you use large images, you get a StackOverflowError . The man decided to take advantage and found a mistake. And I didn’t just find it. and also wrote about her. This is a new step in the development of the library. Moreover, I didn’t really have a solution. At a certain point, one of the testers from Russia proposed a solution. But it was raw and not made properly and I did not accept it. And when it was time to publish the library in Maven Central, it was necessary to solve something with this defect; I didn’t want to publish it along with it. In addition, there was another defect that I never fixed and it also brought a lot of inconvenience.

Command Line Usage. Autumn 2018

The next stage in development was communication with a Swede (Renato Athaydes), who wanted to use the library via the command line and for this it was necessary to make some changes and additions. I was again amazed and surprised by this. After the graphic designer wrote to me, my surprise was somewhat less, but still very high. The thought that someone really needed my code filled me with incredible feelings. He made the necessary changes and prepared the code. I conducted a code review, that is, I looked at the changes, there were comments that were changed and the changes were already in the library. I designated these changes as version v2.0. The next step was to add the library to Maven Central - a central repository, from where you can download it for any project and use it as a dependency. At that time, I had no idea how to do this, even remotely, so I said I was busy and asked him to perform all the steps that were necessary to set up the project. But this turned out to be not enough at all and the most interesting thing was to set up a connection with Maven Central. This is a wild pain, which I couldn’t do the first time, and it was only on April 15 that I was able to publish the project on Maven Central. It wasn't easy, but as others like to say, "everyone who wants to publish their Java code goes through this." Before I published the library, I finally found what and how to do with defects that had been going on for a long time and released a new version v2.0.2 , in which I thanked all those who helped me, described what and how I did.

Publishing to Maven Central. Spring 2019

To publish a library correctly, you need to have a good understanding of versioning and how to set versions correctly. I will stick to this scheme:
  • XX.YY.BBBB , where XX is a major version update that entails changes that are incompatible with the previous one (for example, changing the returning result in methods);
  • YY is a minor update - an internal change or expansion that does not change what is BBBB - these are defects that have been fixed.
  • For example, version 2.0.2 means that the major version is 2, there were no minor updates, and there are two updates for defects.
Next, it was important to figure out how to correctly set groupId and artifactId . They had to be selected once and used further. And they make up the package in which the code is stored. Was: ua.comparison.image Now: com.github.romankh3.image.comparison And this is clearly better, since everyone knows that this is a project from GitHub and can be found from a person with the nickname romankh3. When I did all this, I released a new version v2.1.0 .

Communication with the Swedes. May 2019

After I published the library, another Swede (Mika Kytöläinen) emailed me and asked his friend to make changes to my library. He says that he really needs this and he will be very happy if we do it and do it quickly. Of course, I was not against the changes that were needed. He suggested adding a line thickness configuration that draws a rectangle. Like, for those who have poor vision, this will be a useful change. Prepared the code . Having added a few more changes, I released version v2.2.0

Communication with a German. May 2019

After this, one German created an issue in which he says that he wants to use it for testing, but it lacks functionality. He made many proposals that were very interesting, he suggested that instead of returning only the resulting picture with the result as a result of comparison, return a set of data: what was compared, the result (if necessary) and the state in which there will be MATCH, MISMATCH, SIZE_MISMATCH . Even made the changes. But they did not take into account the previous code at all and were made hastily. I rejected them and offered to carry them out as I saw fit. Despite this, he responded more and I decided that I would do it myself and release a new version. At the same time, Mika Kytöläinen proposed another interesting functionality - adding areas that would not be included in the comparison. This is a real case. And all this was released in v3.0.0

Use in a real project

At the end of May, an automation tester from Kyiv wrote to me, who became interested in the library and wants to use it in a real project that brings in money. It was a breakthrough! Using it somewhere in a pet-project is one thing, but using it in a real project is a completely different matter. We discussed what and how it works. The application is very interesting: in their application they have checks that are printed and it was necessary to check that the checks are created according to a certain template and it does not change. But there was a problem that sections such as date and time always changed and had to be ignored. We had already added functionality to ignore some areas, but it turned out to be still very raw for real use and we still worked fruitfully together for several weeks on this. The result was the release of version v3.1.1

Finding a Niche

After that, I realized that the real niche for my library was using it in tests. To do this, I decided to find some kind of forum for testers and write to them about it in order to get some feedback and increase fame. I found a Russian-language forum and published an article there: Organization of testing images - comparison of two similar ones . In it I received real feedback on the code and functionality, which I applied and released a new version v3.2.0 , and then v.3.3.0 .

Now

The library currently has 60 stars on Github and has 33 forks. I think this is very cool considering the fact that I didn’t promote it in any way except for an article on the forum for automators. Thanks to everyone who read to the end. It actually turned out to be a much longer article than I expected. An article on how to publish a library to Maven Central. If you have anything to add, write! If you have anything to suggest to improve the library, write! I will read everything and devote proper time to it. Anyone who liked the article and found it useful - rate it and write in the comments. Also, subscribe to my github account romankh3 See also my other articles:
Comments
  • Popular
  • New
  • Old
You must be signed in to leave a comment
This page doesn't have any comments yet