📜 ⬆️ ⬇️

Open source projects: Media Player Classic and SharpDevelop. First impressions

Something unimaginable is created in the development world: popular programs, fundamental libraries are laid out in open source. Ordinary developers have the opportunity to make changes to known products. So I, tired of the daily routine, decided to try something new, to feel the flight of creative thought and to join the great one. In simple terms, I decided to connect to any open source project.

Why open source? I am attracted to:

In this article I would like to describe the first experience with two projects: Media Player Classic - Home Cinema and SharpDevelop. I would like to give general recommendations for working with an open source project at an early stage. The article does not contain a full-fledged analysis of the source code or advertising of the new functionality, it only describes the first impressions of working with projects. Perhaps the article will attract the attention of developers to the projects described in it and to the development of open source as a whole.

Media Player Classic - Home Cinema


First of all, I became interested in the program Media Player Classic - Home Cinema (MPC-HC), a free audio and video player for Windows. I still consider the player one of the fastest and most convenient. The program is written in C ++, the interface is designed using the MFC library.

The source code of the program is on github, the list of active tasks is maintained on a separate bug tracker controlled by the Track system. In addition, you can chat in real time with the development team on the IRC channel. To do this, you need to take into account the time, since most of the developers are in European countries (Germany, France, the Netherlands, etc.).
')
Source Code: github.com/mpc-hc/mpc-hc
Task Tracker: trac.mpc-hc.org
IRC developer chat: webchat.freenode.net/?randomnick=1&channels=mpc-hc-dev&prompt=1&uio=d4
Official site: mpc-hc.org

After reviewing the task list, I chose task # 4328: it was necessary to add a button for closing the program to the main program panel for people with disabilities. After spending a couple of hours, I added a new button, checked the program and created a pull request.

In the comments to the pull request, the developers wrote that such a button is not needed. When asked why such a task is hanging on the tracker, I was told that a huge number of tasks are hanging on the tracker, which the team did not watch due to lack of time. Then, right in the comments there was a discussion of what can be added to the player: an exit button from the full-screen mode or a preview window on the scroll bar (a la Youtube player). Unfortunately, the discussion did not produce concrete results.

As I understand it, the project has a backbone of developers who are actively developing their tasks. Most of the tasks that hang on the tracker are in an irrelevant state. Basically this feature requests from users. When asked what task can be performed by the new participant, the developers are not ready to give an answer, however, if they offer a new functionality for the player, the developers can give arguments against it. You can independently choose and perform any task, however, there will be no guarantees that the task will be relevant and the changes will be dealt with from the main branch. So the new participant to connect to the project is very difficult.

By the way, the lonely version of the player with an additional button for closing the program remained on the computer.

image

SharpDevelop


After an unsuccessful attempt to work with MPC-HC, my mind fell on SharpDevelop, an open development environment for programming languages ​​based on .NET. The project was developed in C # .NET 4.5. The program interface is designed using WPF and WinForms. On Habré, quite a lot has already been written about the capabilities of the program; I will not repeat it.

The source code of the product is on github, the list of active tasks is maintained there. You can write a letter to the developers on a separate forum, the answer comes fairly quickly, within 1-2 days. In addition, there is a build-server from which you can download current program binaries or an installation package. Assembly is performed at intervals of 2-3 days.

Source Code: github.com/icsharpcode/SharpDevelop
Forum: community.sharpdevelop.net/forums
CI server: build.sharpdevelop.net/BuildArtefacts
Official website: www.icsharpcode.net/OpenSource/SD

The structure of the project can not but rejoice: the source code is separated into individual components, a full-fledged plug-in system is implemented.

Support for the Subversion version control system is implemented in a separate plug-in module SubversionAddIn.dll, work with Subversion is performed using the SharpSvn library. Git support is also moved to a separate GitAddIn.dll module, however, version control is already running via the git command line.

Support for various programming languages ​​is also separated by individual plug-ins: CppBinding.dll, CSharpBinding.dll, FSharpBinding.dll, VBBinding.dll.

The logic of parsing the source code is taken out in a separate full-fledged project NRefactory. Unfortunately, unlike the Roslyn project, the NRefactory library does not implement compiling IL code and parsing VB.NET code.

To begin with, I chose from the list of tasks an error under number # 606. After closing the “Configuration Editor” window (configuration and platform settings window), the selected Debug or Release configuration did not become active for the entire solution. Having fixed the error with just one line of code, I created a pull request. A few days later my changes were applied to the main branch of the project by one of the developers.

Then I chose a more interesting task under the number # 96: it was necessary to add a window to edit the AssemblyInfo.cs file by analogy with Visual Studio. Now in the properties of the SharpDevelop project there is a new “Assembly Info” tab with input fields for the properties of the assembly. Compared to the Visual Studio dialog box, there are even a few innovations: the “New GUID” button for generating a new build guide and the ability to enable / disable JIT optimizations for the build.

I performed the work with the source code of the AssemblyInfo.cs file using the NRefactory library mentioned above.
A few days later my changes were dealt with the main branch of the product without additional comments. It alerted me a little, as I expected to hear comments or suggestions on the new tab. I am afraid that anyone can trash the project: duplicate functionality or introduce logic that is different from the main logic of the program. I hope that this is not the case, and the changes of the developers still undergo some kind of testing.

Below is a screenshot of the new “Assembly Info” tab, which has already appeared in the beta version of the product 5.1.0.4954.

image

General recommendations


Finally, some useful tips for novice open source developers.

Select the first task

Before full work on the project, you need to check the response from the main development team. In order not to waste a lot of time in vain, you need to choose a small task. Best of all, this will be a bug, and not a new functionality, since there will definitely be no doubt that the changes made were really needed. The task is better to choose from the area in which you understand best of all, so that, again, not to lose too much time to learn new technologies or the specifics of the project.
In my case, it was better to choose a task related to the user interface of the program.
After it turns out that the development team responds promptly to requests for change, you can choose a more serious and interesting task.

Code design

If we talk about the rules for the design of the C # code, then they are mainly dictated to us by the ReSharper default settings for a long time. However, in different projects, for some reason, now and then there are small differences. Here are some of them:

Comments

Do not forget to write comments to the code in the desired language. Most likely the project you choose will be developed by people from different countries and comments will be in English.

Lyrics

If necessary, add the license texts to the code files. For the SharpDevelop project, for example, starting with version 5, the source code files contain the text of the MIT license, and for the Media Player Classic project, the text of the GNU GPL license.

Indentation

In various projects, the design of indentation in the code may also vary: for Media Player Classic, these are spaces, and for SharpDevelop, tabs are characters.

General logic of the program

When working on a task, pay attention to the overall logic of the program. For example, the logic of exception handling or the logic of checking user input. Does it make sense to independently catch exceptions in your code and issue an error message, or is the program already defined a global exception handler? How to give the user a warning about incorrectly entered data? Surprisingly, the logic of the work can vary dramatically in different programs.

Check before creating pull request

After completing the task and before creating the pull request, I recommend performing a thorough check of your changes.

List of changed files

Using the version control system or the built-in development environment tools, you need to check the list of changed files. Perhaps the code was accidentally changed during the development process, perhaps the development environment decided to change the files on its own.

Build project

In the ideal case, you need to download a separate solution folder from your fork repository and re-compile. Visual Studio with integrated git support let me down a couple of times: new source code files were not added to the list of modified files. It was possible to make sure that the changes were correct only by assembling the project from a separately downloaded folder.

Build and run tests

Tests can be in a separate project or even a solution. They can be easily forgotten during development.

Work of the program on various operating systems

If you are not 100% sure that the written code will work on all supported operating systems, it is better to test the operation of the program on virtual machines.

I have it all. As a result of searching and working with open source projects, I managed not only to find a new hobby, but also to learn something new for myself. Then I think to continue working with the SharpDevelop project or “take by storm” Media Player Classic. It may even make sense to look towards other projects, because there are quite a lot of them: Roslyn, .NET Core, Entity Framework and many others.

Source: https://habr.com/ru/post/248481/


All Articles