See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/228840796 Techniques of Improving Open Source Software Tools Article · January 2010 CITATIONS READS 2 237 2 authors, including: Daniel Milodin Bucharest Academy of Economic Studies 26 PUBLICATIONS 34 CITATIONS SEE PROFILE All content following this page was uploaded by Daniel Milodin on 25 August 2014. The user has requested enhancement of the downloaded file. Open Source Science Journal Vol. 2, No. 3, 2010 Techniques of Improving Open Source Software Tools Mihai GEORGESCU Academy of Economic Studies, Bucharest, Romania mihai.georgescu@europe.com Daniel MILODIN, PhD Academy of Economic Studies, Bucharest, Romania daniel.milodin@ase.ro Abstract: Ways of improving open source software applications are presented by providing examples. The need of improving software applications is analyzed. The new features added to the software application are tested. An AddIn is developed in order to highlight the necessary steps for improving an open source application. The necessary requirements and procedures are presented. Keywords: improvement, open source, software, addin, plugin, tools. 1. Open Source Software Characteristics The Open Source Software OSS concept was defined by Open Source Initiative OSI, through Open Source Definition OSD. OSD is used to determine whether a software product is an open source one. Open Source Software definition contains a set of criteria that must be considered in the software license models. The main characteristics of OSS are: - free distribution and redistribution; - publicly available source code; - source code available for modification and redistribution; - no users/groups discrimination. Open Source Software products have reached a remarkably level of popularity in the last years. The Open Source projects success lays both on development process and requirements engineering process, which are well suited to the demands of users and developers. Due to the heterogeneity of involved communities these open source applications are usually designed to allow increased complexity both in terms of functionality and number of users. Open source applications are opened systems that may be improved and extended using different types of techniques. Open Source applications improvement might be splited into two main categories: - quality improvement of existing functionalities by source code modification; - system improvement in general by adding new functionalities to meet user needs. To gain market, an open source application should provide functionality similar to commercial applications. An user chooses open source instead of the commercial business if the first one is able to successfully perform the same work with a similar effort from user side. Therefore, open source applications must be designed in such a way that it can be easily improved or integrated with other systems. 34 Open Source Science Journal Vol. 2, No. 3, 2010 Table 1. Comparison of features between SharpDevelop and Microsoft Visual Studio Express Visual Studio Express Feature SharpDevelop 3.0 SharpDevelop 2.2 Editions Code autoYes Yes Yes completion Code syntax Yes Yes Yes highlighting Windows Forms Yes Yes Yes Designer Web Forms Provided with Visual No No Designer Web Developer Code Coverage Yes Yes No Unit Testing Yes Yes No Languages C#, VB.NET, Boo, F#, C#, VB.NET, Boo C#, C++, VB.NET, J# Supported IronPython Help No No Yes documentation No explicit support for plug-ins however third Plug-in support Yes Yes party plug-ins can work with the Express edition. Insert PInvoke Yes Yes No Signatures Testing Regular Yes Yes No Expressions Class View Yes Yes Yes Solution Explorer Yes Yes Yes Project and Solution File MSBuild MSBuild MSBuild Format Web references Yes Yes Yes Rename, Extract Refactorings Method, Remove Rename Rename, Extract Method unused imports Go to definition Yes Yes Yes Find References Yes Yes Yes Yes. Not as powerful Yes. Not as powerful as Visual Studio's as Visual Studio's Code generation Yes Code Snippet Code Snippet Manager. Manager. Object Browser Yes Yes Yes Yes. Lacking support Database Explorer No for many database Yes providers. Publishing No No Yes 35 Open Source Science Journal Data Sources View Add Data Source Wizard Document Outline View Resources ActiveX Toolbox Items Vol. 2, No. 3, 2010 No No Yes No No Yes No No Yes Local and project Partial - need to generate .NET interop library Local only Local and project Partial - need to generate .NET interop Yes library Integrated Yes debugger Targeting different Yes .NET frameworks Yes Yes Yes No Reporting Yes Yes Task List Error List Database Designer Tools Code conversion Integrated NAnt support Integrated WiX support Integrated FxCop support Integrated StyleCop support Navigation History XPath Queries Incremental Search XML documentation preview and generation Yes Yes Yes Yes Yes through the report viewer plug-in Yes Yes No No Yes Yes Yes No No Yes No Yes Yes No Yes Yes No Yes No No Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes No To be competitive, a software application must be continuously improved as technology evolves side by side with user needs. The next chapter of this paper describes techniques used for open source software improvement. 2. Open Source Software Improvement Techniques Open source software improvement involves either improving the quality of existing functionality or improving the application by adding new functionality. 36 Open Source Science Journal Vol. 2, No. 3, 2010 Open source development and distribution processes are often "bug-driven”, by saying that each change in the source code is being made on a bug report, leading to the improvement of initial distribution. Each user or developer may contribute to the improvement of an open source application by reporting bugs to the community or by changing the source code. Improving an open source application as a whole, by adding new functionalities is achieved either by the community or by a third party by adding new extensions that do not affect the main distribution. Many open source applications have been designed to enable development and integration of new extensions (plugins, add-ons, theme) and customizations so that the user has a higher productivity. Plugins and add-on are two terms pointing the same functionality, they represent extensions that improves the usability of a program. The differences between the two terms are of empirical nature. These extensions are made either by third party companies and individuals or by the owner of the software. Plug-in is the term that is usually used when referring to third party software that is meant to interact with a certain program. For example a web browser and a flash player plugin used for playing videos. Flash Player is not native to any of the existing web browsers, but is made by a third party company and is still compatible with most popular web browsers (IE, Firefox, Opera). Figure 1 schematically presents the interaction between SharpDevelop and clock AddIn, used as an example in this paper. Fig. 1. Architecture of SharpDevelop’s AddIn system for cloc AddIn Add-on's also extend functionality of a certain software, but they are usually designed to function on a certain program. Taking the web browser for comparison, an add-on developed for a particular browser will work only on that type of browser. In other words, an add-on for Firefox is not compatible and will not work on Internet Explorer. These extensions are not stand-alone applications, but are pieces of code that can be used to modify the interface. The separation between plug-in and add-on is not really that clear. They are both designed to meet specific requirements and are suited to a certain user’s preference. The main reason why these extensions are not added to the main distribution is that these features are not really that essential. Another reason is that not all users need these functionalities, while some people might appreciate having that, others might not. These extensions are also tools to motivate the members of the community to get involved in improving the software. 37 Open Source Science Journal Vol. 2, No. 3, 2010 Another way of improving open source software is to help other members of community to use and better understand the application. This is accomplished by documentation addressed to specific groups within the community, whether end users or specialists in software. User manuals are directly addressed to end users, while for specialists the list of documents and their complexity is increased. For specialists there are architecture and design documents, source code documentation or maintenance documents. 3. Improvement of the SharpDevelop 3.2 software tool SharpDevelop V3.2 (#develop) is an integrated software development environment (IDE) for .NET framework applications. Supports development of applications in C#, Visual Basic .NET, Boo and IronPython. It is open source and written in C#. The webpage of the project is http://www.icsharpcode.net/opensource/sd/. It provides all the functionality required of a modern development environment, like code completion, project templates, integrated debugger and window designer. The main features of SharpDevelop are: - creation of Windows applications; - visual design of windows; - automatic code completion; - automatic code generation; - automatic generation of class diagram; - refactoring; - XML comments; - debugging; - code conversion between different programming languages; - testing of modules; - building applications in Boo language. It offers ways of adding new functionalities by using AddIns. There are three types of AddIns, classified by their directory location in ShapDevelop: - Pre-installed AddIns o are installed in the folder AddIns; o cannot be updated or uninstalled by the AddInManager; o are shown in AddInManeger only if “show pre-installed AddIns” option is selected, they can only be disabled or enabled. - External AddIns o are installed in any other directory, outside the SharpDevelop directory; o are registerd in AddInManager; o cannot be updated inside AddInManager; o uninstalling only unregisters the AddIn, but does not delete the file. - User AddIns o are installed in the user profile folder; o are distributed inside a “.sdaddin” package file (AddInManager extracts the file into the user profile); o are updatable (by installing the new version inside the AddInManager); o uninstalling deletes the files from the user profile. The goal of this paper is to develop an AddIn that displays the number of source code lines inside a project or solution created with SharpDevelop. The AddIn contains a configuration screen and uses the cloc.exe utility for obtaining the number of code lines, utility which is described in detail in [1]. 38 Open Source Science Journal Vol. 2, No. 3, 2010 In order to complete the project, the following requirements must be met, described also in [2]: - SharpDevelop V3.2 must be installed; - SharpDevelop V3.x source code available on disk; - SharpDevelop is compiled by running the batch file debugbuild.bat inside src folder. Moreover, the cloc.exe utility must be available. It can be downloaded from http://cloc.sourceforge.net The reader of this paper should have a basic understanding of the C# language and the .NET framework in order to complete this example. A minimal experience of working with SharpDevelop is required. A new project is created of type SharpDevelop addin inside SharpDevelop as it is displayed in figure 2: Fig. 2. Creating a new project of type SharpDevelop addin SharpDevelop automatically creates the AddIn template. The references to ICSharpCode.Core and ICSharpCode.SharpDevelop are added manually. The dll files are found in bin directory inside SharpDevelop source code folder. For each reference the property LocalCopy = false is set as in figure 3. 39 Open Source Science Journal Vol. 2, No. 3, 2010 Fig. 3. Properties for ICSharpCode.Core and ICSharpCode.SharpDevelop The project properties are changed in order to set the Output Path to the folder that contains the source code of SharpDevelop, in folder SharpDevelop\AddIns\AddIns. In Debug properties, in region Start external program, the SharpDevelop.exe executable is selected from SharpDevelop\bin folder. In figure 4, the current files contained in the project are presented: Fig. 4. cloc AddIn project content An important file of the AddIn is cloc.addin. This file describes which parts of SharpDevelop are extended by the AddIn. SharpDevelop loads the AddIn only when it needs it, optimizing the startup time of the application. The structure of this file is the following: <AddIn name = "cloc" author = "Mihai Georgescu" url = "http://www.mihaigeorgescu.com" description = "Based on cloc.exe it counts lines of source code."> <Manifest> <Identity name="MG.cloc"/> <Dependency addin="SharpDevelop" version="3.0"/> </Manifest> <Runtime> <Import assembly = "cloc.dll"/> 40 Open Source Science Journal Vol. 2, No. 3, 2010 </Runtime> <Path name = > </Path> </AddIn> In order to make the AddIn unique, the following information is added in cloc.addin: <Manifest> <Identity name="MG.cloc"/> <Dependency addin="SharpDevelop" version="3.0"/> </Manifest> This also informs SharpDevelop that the AddIn is compatible with version 3.0. For more information about the possible extensions paths and how the AddinTree works in detail, read the document „AddInTree“ in the SharpDevelop source folder\doc\technotes. The cloc project is compiled. In the output path the following files are created: - cloc.addin; - cloc.dll; - cloc.pdb. The utility cloc.exe is copied in the same folder with the above files. In the project structure a new directory is created called src that contains the AddIn’s source files developed in this paper. The main window of the project is created having the Windows Form type and named FormMain, defined in FormMain.cs unit, as in figure 5. Fig. 5. Creating the main window In figure 6 the layout of the main window is presented. The window contains three regions: options, results and command buttons. 41 Open Source Science Journal Vol. 2, No. 3, 2010 Fig. 6. FormMain.cs layout To display the window, an instance to FormMain must be created. A new class called ShowFormMainCommand defined in unit ShowFormMainCommand.cs is created, needed to display the window. The goal is to integrate the MainForm in SharpDevelop under Tools menu as a command. To achieve this, an abstract class called ICSharpCode.Core. AbstractMenuCommand is used that contains all the necessary methods that must be implemented. The ShowFormMainCommand class is derived from the AbstractMenuCommand class and it has the following implementation: public class ShowFormMainCommand:AbstractMenuCommand { public override void Run() { FormMain form = new FormMain(); form.ShowDialog(); } } The file cloc.addin is changed in order to insert a new item in Tools menu as follows: <Path name = "/Workspace/Tools"> <MenuItem id = "clocCommand" label = "cloc Addin" class = "cloc.ShowFormMainCommand"/> </Path> The AddIn is ran, SharpDevelop is automatically started and under Tools menu a new item named cloc Addin is displayed as it was specified in the cloc.addin file. The command launches the MainForm defined in cloc.dll as in figure 7. 42 Open Source Science Journal Vol. 2, No. 3, 2010 Fig. 7. cloc AddIn available as a new item in SharpDevelop/Tools menu In Debug window shown in figure 8, it is observed how SharpDevelop loads the file cloc.dll and executes the ShowFormMainCommand. Fig. 8. SharpDevelop Debug window A new class called ClocLauncher is created. This class is responsible of executing the cloc.exe utility as well as reading the output from it. The output from cloc.exe is then displayed in the main AddIn window. The class implementation is the following: public class ClocLauncher { public static string ShowInformation(string path) { if(string.IsNullOrEmpty(path)) return "Path not found."; string param = "\"" + path + "\""; string currentFolder = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly(). Location); string clocExe = currentFolder + System.IO.Path.DirectorySeparatorChar + "cloc.exe"; return GetOutput(clocExe, param); 43 Open Source Science Journal Vol. 2, No. 3, 2010 } private static string GetOutput(string filename, string param) { string output = string.Empty; Process p = new Process(); // Redirect the output stream of the child process. p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = filename; p.StartInfo.Arguments = param; p.StartInfo.CreateNoWindow = true; p.Start(); p.WaitForExit(); if (p.HasExited) { output = p.StandardOutput.ReadToEnd(); } return output; } } The GetOutput() method creates a new process that launches cloc.exe having the path to cloc.exe and the current source file/the solution directory as input parameters. The ShowInformation() method prepares the paths to cloc.exe as well as its launching parameters and calls the GetOutput() method. The MainForm is improved with options to select either current file of the project or the whole solution directory of SharpDevelop. The output from GetOutput() is displayed inside a RichTextBox control as shown in figure 9. Fig. 9. FormMain extended layout To obtain the paths to the current file and to the solution directory the following methods are used: /// <summary> /// Obtains the active document filename.cs from SharpDevelop /// </summary> /// <returns>Active document filename.</returns> private string GetCurrentFilename() { 44 Open Source Science Journal Vol. 2, No. 3, 2010 IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; if (window == null || window.ActiveViewContent.PrimaryFileName == null || window.ActiveViewContent.IsViewOnly) { return string.Empty; } string currentFileName = window.ActiveViewContent.PrimaryFileName; if (System.IO.Path.GetExtension(currentFileName) != ".cs") { // not C# file return string.Empty; } return currentFileName; } private string GetSolutionDir() { Solution solution = ProjectService.OpenSolution; return solution.Directory; } The Run button on the main window has assigned the following code that is executed when the button is clicked: void BtnRunClick(object sender, EventArgs e) { string output = string.Empty; string path = string.Empty; // Current file if(rbCurrentFile.Checked) path = GetCurrentFilename(); else path = GetSolutionDir(); output = ClocLauncher.ShowInformation(path); rtbOutput.Clear(); rtbOutput.Text = output; } When the AddIn is ran on a source file of a test project the results in figure 10 are obtained. Fig. 10. cloc AddIn displaying information for the current file of a test project 45 Open Source Science Journal Vol. 2, No. 3, 2010 When running the AddIn on the entire solution directory of a test project the results in figure 11 are obtained. Fig. 11. cloc AddIn displaying information for the entire solution directory of a test project The AddIn can be further developed to integrate more with SharpDevelop. It can be automatically launched by using a keyboard combination on the current selected file. 4. Conclusions The open source applications are targeted on an heterogeneous community. Due to this reason, many applications were designed to allow easy extension of functionality. A software application is improved either by changing the source code of the application itself or by adding new functionalities using addins. The main techniques of improvement of an open source application are: - changing the source code; - adding of extensions (plugins, addins); - application documentation. By developing the cloc AddIn it has been described how an open source tool called cloc.exe was integrated in the SharpDevelop V3.2 development environment, both software tools are described in detail in [1] paper. Table 2. New features added to SharpDevelop V3.2 Feature SharpDevelop 3.2 SharpDevelop Improved Count of blank lines No Yes Count of comment lines No Yes Count of files Yes Yes Count of code lines No Yes cloc.exe integration No Yes 46 Open Source Science Journal Vol. 2, No. 3, 2010 The project presented in this paper added basic statistical information regarding the source code. Based on this information the user can optimize the source files by splitting them if they are too long. The effort and the knowledge needed to extend an open source application is minimized due to the software design that allows such improvements. References [1] M. Georgescu and D. Milodin, „Open Source Tools to Assist in the Development of Software Applications,” Open Source Science Journal, Vol. 2, No. 2, 2010, ISSN 2066 – 740X. [2] I. Ivan and L. Sacuiu, „Quality of Open Source Integrated Software,” Open Source Science Journal, Vol. 2, No 1, 2010, ISSN 2066 – 740X. [3] C. Ciurea, „Open Source Tools for Collaborative Systems Hierarchization,” Open Source Science Journal, Vol. 2, No. 2, 2010, ISSN 2066 – 740X. [4] I. Ivan, C. Ciurea and D. Milodin, „Collaborative Educational System Analysis and Assessment,” Proceedings on The Third International Conference on Advances in ComputerHuman Interactions, ACHI 2010, Saint Maarten, Netherlands Antilles, February 10-16, 2010. [5] I. Ivan and C. Boja, Metode statistice în analiza software, ASE Publishing House, Bucharest, 2004. [6] D. Milodin, The orthogonality of the structured entities, PhD Thesis, Academy of Economic Studies, Bucharest, 2009. [7] I. Radulescu, „Open Source Tools to Measure Software Complexity,” Open Source Science Journal, Vol. 1, No 2, 2009, ISSN 2066 – 740X. [8] M. Doinea, „Open Source Security Tools,” Open Source Science Journal, Vol. 2, No. 2. 2010, ISSN 2066 – 740X. [9] http://wiki.sharpdevelop.net/AddinWritingHelp.ashx [10] C. Ciurea, “Metrics of Collaborative Banking Systems,” Journal of Applied Collaborative Systems, Vol. 2, No. 1, 2010, ISSN 2066-7450. [11] http://opensource.org/docs/definition.php [12] http://en.wikipedia.org/wiki/Plug-in_%28computing%29 [13] http://wiki.sharpdevelop.net/AddinWritingHelp.ashx [14] W. Scacchi, „Understanding Free/Open Source Software Evolution,” in N. H. Madhavji, J. F. Ramil and D. Perry (Eds.), Software Evolution and Feedback: Theory and Practice, John Wiley and Sons Inc, New York, 181-206, 2006. 47 Open Source Science Journal Vol. 2, No. 3, 2010 [15] http://www.sourceforge.net [16] A. Engelfriet, „Choosing an Open Source License,” IEEE Software, Vol. 27, No. 1, pp. 48-49, Jan./Feb. 2010. [17] M. Weiss, G. Moroiu and P. Zhao, „Evolution of Open Source Communities,” in Damiani, E., Fitzgerald, B., Scacchi, W., Scotto, M. and Succi, G., (Eds.), Open Source Systems, IFIP Vol. 203, Springer, Boston, 21-32, 2006. [18] http://cloc.sourceforge.net/ [19] http://www.codeproject.com/KB/cs/LineCounterSDAddIn.aspx Authors Mihai GEORGESCU has graduated the Faculty of Electronics, Telecommunications and Information Technology – Politehnica University Bucharest in 2005 and also completed a master program at the Faculty of Economic Cybernetics, Statistics and Informatics from the Bucharest Academy of Economic Studies in 2007. He has experience in the development of software products using various programming languages like C/C++, C# both Windows Forms and Web. Daniel MILODIN graduated the Economic Informatics department of the Faculty of Economic Cybernetics, Statistics and Informatics in 2005. He followed the master program “Project’s Computerized Management" between 2005 and 2007. He has published several articles in specialized magazines, articles focused mainly on studying and implementing the concept of orthogonality: the orthogonality of the alphabets, of the Arabic digits, of the Latin alphabet, of the distributed informatics applications and of the structured entities. The dissertation paper within the master is placed on the same line of research, "The projects’ orthogonality, conditions of entry into the assessment program”, proposing to define the projects’ concept of orthogonality, methods for determining the degree of similarity between two projects, and also to develop software products for identifying similar projects. He is a PhD graduate of the Academy of Economic Studies, specialization "Economic Science", with the thesis "The orthogonality of the structured entities”. 48 View publication stats