Tuesday, 1 December 2009

The Value of Refactoring in Open Source Software.

Code refactoring is a practice of software engineering that address maintainability. The effect (or the goal - if it is only this one) to produce more readable code is not secondary to increased stability and consistency to a predetermined (or evolving) paradigm.

Change the internal structure of a well-identified portion of code may not affect the functionality of it. If the modification is not explicitly evolutionary, your gain is (as said before) maintainability / readability: this should not be underestimated because it means that this piece of code will be more inclined to change and extensibility.

All this can be done without the worry of worsening the code or allow the resurface of solved issues if there is a good unit tests coverage.

Refactoring is essential in any software, but in an open source project the high complexity of the code, the one regarding the neglect of the objective of legibility, will keep away potential contributors. Nevertheless, if your project is targeted primarily to developers: complex code (or code indecipherable unless interspersed with many lines of comments) will prevent the adoption by the latter.

For example you might notice how the refactoring has evolved a core part of a open source project of my creation (the one when I can spend more time at the moment): Command Line Parser Library.
Who loves to study things in detail (like me) can analyze the evolution of the following types from version 1.7.0.1 alfa to version 1.7.10.5 beta.
If you have time to examine these sources, I'm very interested in your opinion.

I'll return to this argument as soon as possible to investigate further. We could devote an entire blog... Don't forget that there are several books and a lot of material on the web about this topic.

Bye.

Sunday, 22 November 2009

CommandLine.dll 1.7.0.1 alfa.

Command Line Parser Library enters the 1.7.x branch. This new alfa introduces changes into parser core.

Using the new OptionArray attribute you can store multiple values into a field array. See the release home for details. Download sources from this page or from source code control repository.

Obviously there are other improvements as the ones made to CommandLine.Text.HelpText type: word wrap and more control on options text block.

Please also check the progress in documentation section.

Good command line parsing!

Thursday, 12 November 2009

Again... CommandLine.dll - News

You can get 1.6.0.77 beta from Downloads section or following this link.

But if you really want the latest version, you must check the source code control repository. At this moment the last downloadable version (e.g. with SVN client) is 1.6.9.95 beta.

This is the first version that has a real contribution by another developer: Steven Evans. He has provided to HelpText type the ability to word wrap when emitting text.

Thank you, Steven!

Bye.

Tuesday, 3 November 2009

CommandLine.dll, more documentation and a new minor update - 1.6.0.5 Stable

Read the home of the new release for understand changes of this minor update: 1.6.0.5 stable.

I'm taking advantage of new documentation section of  projects hosted on CodePlex. The work is under construction, but a complete Quickstart Guide is available.

As always comments are well appreciated.

Good reading!

Thursday, 17 September 2009

Command Line Library 1.6 Stable, available.

I've finally released the new stable version of Command Line Parser Library, 1.6. This release makes final features introduced with latest two beta.

Here the most interesting:
  • control on case's comparison
  • various fixes
  • various user requests satisfied
Enjoy it!

Sunday, 13 September 2009

Testing upcoming CommandLine.dll on linux platform.

These days I'm working on upcoming version 1.6 of Command Line Parser Library (during spare time!). Expect soon the publication on Codeplex web site.

As you can see in the picture, a stable version is tested also on Linux platform with Mono.
The tests performed on Linux includes building the project with NAnt, running NUnit tests and executing the sample application.

Bye!

Tuesday, 8 September 2009

Oslo, code name for future Microsoft modeling technologies.

Oslo, is the code name of the next generation of Microsoft modeling technologies. You can download and install May 2009 CTP version. I suggest you to experiment preview releases using virtualization software.

Oslo innovates application lifecycle management introducing model driven development (MDD), hence the practical application of concepts from model driven architecture (MDA) and model driven engineering (MDE).

In a nutshell Oslo gives you tools to define application domain's entities and logic (the model). This metadata will be stored in a repository (SQL Server) and used to generate your application.

With this new technology Microsoft gives birth to Quadrant, a visual modeling tool, Intellipad, a textual utility oriented to MDD an M, a new language, underlying the model's definition.
    So, if you work with Microsoft's technologies, you've a lot of thing to learn...

    Happy studying!

    Sunday, 30 August 2009

    Install OpenOffice 3.1 on Ubuntu 8.04.

    If you want to install latest OpenOffice (at the moment of writing 3.1) on Ubuntu 8.04, you'll notice that is still not supported in standard repositories.

    I used this instructions, but you can find other ways and other instructions for other Ubuntu's versions (and other Debian based Linux OSes).

    Happy open source to everyone!

    Friday, 28 August 2009

    Build Mono 2.4 on Ubuntu.

    I've recently found two interesting posts about installing Mono 2.4 from sources.
    Follow these links:
    [1] http://blog.ruski.co.za/page/Install-Mono-on-Ubuntu.aspx
    [2] http://www.centriment.com/2009/04/01/building-mono-24-from-source-on-ubuntu-810/

    The second link (reference [2]) will help you keep Mono 2.4 with you current Mono installation.

    Enjoy .NET on Linux!

    Tuesday, 25 August 2009

    New Mac OS X is amazing!

    Check out latest Apple engineers efforts on Mac OS X, called Snow Leopard.
    It contains from cool user interface/user interaction improvements to core system innovations to make everything perform better and faster!

    It will be available August 28.

    Nothing more to say, follow the previous link and see with your eyes.

    Good browsing!

    Sunday, 23 August 2009

    Command Line Library 1.5 Beta 2 is here!

    Before a month is now available Beta 2 of Command Line Parser Library 1.5 (release 1.5.96.199 beta 2). Navigate to release page, download and test it.
    This release contains reported bug fixes and various user requests fulfilled.

    As always testing results, bug reports and enhancement requests are always welcome.

    Good download!

    Friday, 21 August 2009

    Superior Backup Tool for Linux

    If you use a Debian or Ubuntu derived distribution, you can take advantage of a great backup tool: remastersys. This tool is able to create a complete backup of your system or (and this is the very interesting thing!) live/installable dvd.

    In the web site's tool you can get instructions to install this wonderful software. The use is very straightforward; for create a complete backup (system+data):

    sudo remastersys backup full_system.iso

    If you want create a live/installable dvd (system), just type at your shell prompt:

    sudo remastersys dist core_system.iso

    As you can see the program create an iso image: this file is good for burning a dvd, but can also be used with virtualization software (changing the virtual optical device with the iso image file).

    Try it, you'll love it! Thank you Tony Brijeski, you've done a great software.

    Good DVD burning!

    Wednesday, 19 August 2009

    .NET and Caching Services

    The first time I found Shared Cache on CodePlex, I immediately thought it would be interesting to try it with Mono on Linux.
    Since the version downloaded that time (December, 2008) was not executed on Mono/Linux platform, I decided to create a new software derived from Shared Cache (fork) able to run on that environment: Cache Reloaded.
    However I'm now working with the staff of Shared Cache, in order to enable it to run on Linux (without forking a new project!).

    The person with whom I'm working is the main author of this software: Roni Schuetz (blog | web site). He, because of our collaboration, added me to the staff of Shared Cache (project home -> people; codeplex id = gsscoder).







    I don't know what future will have Cache Reloaded, probably will be the starting point for porting Shared Cache to Linux... You can read an article about it.

    Have fun with caching!

    See you.

    Thursday, 13 August 2009

    Do you use Command Line Parser Library?

    Erik Ejlskov Jensen, the author of SQL Compact Command Line, does it. As you can see in the last change set (at the moment of writing this blog post) via Source Code tab, the author preferred merging the Command Line Parser source tree with its own.

    SqlCeCmd is a very useful application, as you can read from its project's home page: "Administer SQL Compact databases directly from the command line, without having Visual Studio or SQL Server Management Studio installed. [...]".

    From now every project using Command Line Parser Library will be listed in the project's home page and in Related Projects section, if the project is hosted on CodePlex.

    So, don't be shy :-), write me and tell me if you use my project...

    Good coding to everyone!

    Saturday, 1 August 2009

    CommandLine.dll 1.5.9.9 Beta Released.

    This version was released in order to fullfill an user request about to configure case comparison type (sensitive or not).
    This release is marked beta, because I'd few time for testing (excluded unit-testing). Next stable release will include other users' requests (and will be more tested).

    Enjoy!

    Friday, 31 July 2009

    This blog is alive!

    A big set of job commitments and personal businness has prevented me to update my blog and my projects on CodePlex.
    But now I'm trying to take over the situation and return to work on my open source projects.

    Thanks for your patience!

    Monday, 26 January 2009

    CommandLine.dll: Previous Releases Fix Published!

    The bug found in release 1.5 (see this post) was corrected also in releases already published.
    The problem affected:
    Latest Release (Version 1.5.9.1) is not afflicted from this problem.
    Previous Releases contains now a new download with easy instructions.

    Bye and be free to use the version you like!

    Sunday, 25 January 2009

    CommandLine.dll 1.5.9.1: fix the bug of release 1.5.

    If you have read the previous blog post and you're a CommandLine.dll user, please download the latest release: 1.5.9.1 at CodePlex.

    If you read the {project-root}/doc/ChangeLog, you will have some more details.

    Bye! ;-)

    Sunday, 18 January 2009

    CommandLine.dll 1.5: sneaky bug introduced in latests version(s) - here the patch!

    As soon as possible I will publish the fixed version on CodePlex, for the ones that can't wait follows the patch.
    Replace the content of {project-root}/Core/OptionMap.cs with the one here below.


    namespace CommandLine
    {
    using System.Collections.Generic;

    sealed class OptionMap : IOptionMap
    {
    private Dictionary<string, string> names;
    private Dictionary<string, OptionInfo> map;

    public OptionMap(int capacity)
    {
    this.names = new Dictionary<string, string>(capacity);
    this.map = new Dictionary<string, OptionInfo>(capacity * 2);
    }

    public OptionInfo this[string key]
    {
    get
    {
    OptionInfo option = null;
    if (this.map.ContainsKey(key))
    {
    option = this.map[key];
    }
    else
    {
    string optionKey = null;
    if (this.names.ContainsKey(key))
    {
    optionKey = this.names[key];
    option = this.map[optionKey];
    }
    }
    return option;
    }
    set
    {
    this.map[key] = value;
    if (value.HasBothNames)
    {
    this.names[value.LongName] = value.ShortName;
    }
    }
    }

    public bool EnforceRules()
    {
    foreach (OptionInfo option in this.map.Values)
    {
    if (option.Required && !option.IsDefined)
    {
    return false;
    }
    }
    return true;
    }
    }
    }


    The bug causes the overloads of bool CommandLineParser.ParseArguments(...) to raise an exception, instead of returning false in case of undefined option.
    In the next release I will explain how these kind of thing can happen and how to avoid them.

    Bye!

    Thursday, 15 January 2009

    Hands on Code: Modify Copy Directory Tree 1.1

    Introduction
    The first part of the title states Hands on Code and will prefix every post in which you can find a little tutorial on hacking open source projects.
    Preface
    At the moment of writing this post, cptree, a little utility I wrote for replicate directory tree structures, is marked 1.1 stable. This little command line tool consumes Command Line Parser Library 1.4 stable (from now libcmdline-{VERSION}).
    Tutorial Purpose
    In this tutorial we will upgrade cptree-1.1 to use libcmdline-1.5. Anyway this time we will remove the binary dependency of CommandLine.dll, merging its code with the source of cptree.exe.
    Practice
    Point your browser to cptree release 1.1 page and download cptree-1.1-stable-src.zip. Download also libcmdline-1.5-stable-src.zip from release 1.5 page of libcmdline.
    Unzip cptree source in your project folder. Open the ThisAssembly.cs file located in {cptree-root}/src/Properties.
    static class ThisAssembly
    {
    internal const string Name = "cptree";
    internal const string Title = "cptree.exe";
    internal const string Copyright = "Copyright (C) 2008 Giacomo Stelluti Scala";
    internal const string Version = "1.1.0.0"; //stable
    internal const string InformationalVersion = "1.1.0.0";
    internal const string MajorMinorVersion = "1.1";
    }

    The last four fields should be modified as follows.

    internal const string Copyright = "Copyright (C) 2008 - 2009 Giacomo Stelluti Scala, {Your-Name}";
    internal const string Version = "1.1.0.5"; //stable (gsscoder.blogspot.com tutorial)
    internal const string InformationalVersion = "1.1.0.5";

    Open the CPTreeTool.cs file, located in the project root. Locate the Options nested type and search the following line inside the string GetUsage(void) method.
    info.AddPreOptionsLine("  - Uses CommandLine.dll, Version 1.4 (http://www.codeplex.com/commandline).");

    Replace this line of code with this other one.
    info.AddPreOptionsLine("  - Includes Command Line Library Version 1.5 (http://www.codeplex.com/commandline).");

    Now remove the dependency from CommandLine.dll. If you use some version of MS Visual Studio 2008 you're just one click away from the result.



















    If you use NAnt Build Script you should remove the include tag with the CommandLine.dll string inside the name attribute. This tag is located inside the target tag marked build (attribute name="build").
    Now create a CommandLine directory with a Tests subdirectory in the root of cptree. Decompress the libcmdline-1.5-stable-src.zip/CommandLine/src/libcmdline in a temporary folder. Move all the *Fixture.cs files to {cptree-root}/src/CommandLine/Tests and the remaining *.cs file to {cptree-root}/src/CommandLine (excluding AssemblyInfo.cs and ThisAssembly.cs).
    If you use MS Visual Studio just press the Show All Files button in the project tree, select the CommandLine folder (should be white with dashed border) with the right mouse button and choose Include In Project menu item.
    NAnt users have to modify the build scrirpt located in {cptree-root}/nant named default.build. If you are familiar with this tool you will not find difficulties including al *.cs file of the new .../CommandLine directory. If you want use the same condition to add .../CommandLine/Tests only if this kind of build is required. (I think it's take more time to explain than modify the script...)
    Conclusion
    With this little tutorial we have started learning to manage, modify and work with code written by other persons. I think this is one of the basis of open source.

    The instructions published here are valid also for different project versions. If you want exercise, you could repeat this tutorial with older versions; for example you could merge cptree-1.0-alfa with libcmdline-1.3-stable. This is valid also for future versions: you'll be able to experiment how the next version of libcmdline will operate (and/or merge) with current (1.1-stable) or older versions of cptree.




    For any problem don't esitate to contact me.
    Good Job!

    Monday, 12 January 2009

    Enable syntax highlight in your blog?

    There are various solution to add this syntax highlight in posts of your technical blog. The only problem is to choose the right product for your blog engine.

    I used syntaxhighlighter from Google Code and this blog post to put it working.

    Bye!

    Thursday, 8 January 2009

    Command Line Library 1.5 Stable, published!

    This new release (1.5 stable) supports enumeration types in native way. You can read more about this the release page, where you can download (as always) source code, binaries and documentation (CHM format).

    As older releases sources can be built under Mono (test done under Linux) using NAnt. Published binaries were built using MS Visual C# Express Edition 2008 under a Win32 Platform (you can directly use these files in Mono without rebuilding, if you want...).

    Enjoy!