Sharpdevelop 4 Development Environment

    SharpDevelop logo

    Having read more than a month ago on the hub about the appearance of SharpDevelop 4.0, I did not attach any importance to this, but a little later a colleague reminded me of this post and said that we should definitely try (we did not see this IDE before). I get ahead of myself and say that he never started it, but I, the other day, nevertheless installed it and decided to write a small application in C # that will interact with the MySQL database. All interest in this IDE is caused by the fact that I have not used anything except MS Visual Studio since the 6th version, and smoothly switched already to 2010. Under the cut, I will talk about the impressions that I received from using Sharpdevelop, I will show the main windows (for those who are just interested in what it is) and talk a little about development.


    First of all, we need to download the environment:SharpDevelop . What catches your eye right away is the size of 15535 KB, because I have Visual Studio 2010, then I don’t need to install anything else (we are talking about framework 4).

    We launch the installer and we can choose the file binding:

    file association

    We launch SharpDevelop and when loading it we see such a picture (I couldn’t do it right away, I had to make several attempts, because the loading speed of the environment is very high):

    SharpDevelop logo

    According to many opinions, this is an ideal environment for “weak »Computers. Therefore, downloading it went very quickly, and I was able to see it in all its glory the main window of SharpDevelop 4.0.

    main window

    Here, right away, deja vu appeared that I already saw this somewhere, the interface is very close to Visual Studio, sometimes I even forgot that I was working on SharpDevelop and pressed Ctrl + "." in the hope that using will be added for MySQL. The possibilities are, of course, more modest and for creating a project I chose from the Windows Application menu and got down to business. This window is practically no different from the Visual Studio window, in the upper right corner you can select the version of the framework, possible projects are available on the left. For MySQL we need to install the database and the provider, my choice fell on mysql-essential-5.1.54-win32.msi and mysql-connector-net-6.3.5.zip, which can be found on the offsite: dev.mysql.com , also do not forget to configure the my.ini file to avoid problems with Russian characters.

    new project



    After we create the project, we will see a no less familiar window. There is no desire to do anything “big”, and writing the hello world application is ridiculous, therefore it will be a database of acquaintances indicating their last name, first name and date of birth, by the way, here is the designer: We add a link to the MySql.Data.dll library and we can start writing code. You should also add:

    new project created



    designer


    using MySql.Data;
    using MySql.Data.MySqlClient;

    In the form constructor, add:

    string connStr = "server=localhost;user=root;";
    using (var conn = new MySqlConnection(connStr))
    using (var cmd = conn.CreateCommand())
    {
      conn.Open();
      cmd.CommandText = "CREATE DATABASE IF NOT EXISTS `sharptest`;";
      cmd.ExecuteNonQuery();
    }

    connStr = "server=localhost;user=root;database=sharptest;";
    using (var conn = new MySqlConnection(connStr))
    using (var cmd = conn.CreateCommand())
    {
      conn.Open();
      cmd.CommandText = "CREATE TABLE IF NOT EXISTS `friends` (" +
       "`id` int(11) NOT NULL auto_increment," +
       "`lastname` varchar(50) NOT NULL default ''," +
       "`firstname` varchar(50) NOT NULL default ''," +
       "`birth` date NOT NULL default '1000-01-01'," +
       "PRIMARY KEY (`id`));";
      cmd.ExecuteNonQuery();
    }

    * This source code was highlighted with Source Code Highlighter.


    As hazzik noted in his comments, this code cannot be used in “normal” applications, this is just an example that I wrote in order to familiarize myself with the environment, this application is by no means the final product.

    Of course, it would be worth creating rights to access the database through GRANT rather than using root, but the article is not about that, also basic operations (UPDATE, SELECT, INSERT, DELETE) and the project itself can be downloaded by link or link . I especially want to highlight the fact that MS Visual Studio 2010 and Sharpdevelop understand each other's projects and without problems (conversions) opened projects created by another IDE.

    Now I want to say a few words about working with the code:

    code

    When writing code, hints also pop up, you can look at the parameters and what the method returns, with debugging everything is fine too:

    debug

    Conclusion


    Honestly, I expected that the result of my acquaintance would be sad, but Sharpdevelop was pleasantly surprised, because Today it is a rather powerful product, it has rich functionality, works quickly, takes up little space and most importantly it is free. The purpose of this acquaintance was not to search for alternatives, but only to get acquainted with a new environment that I had not used before. For some people, this IDE will be enough and you can not install the same Visual Studio Express edition (if we are talking about free products), but in my daily work I use quite a few things that are not in Sharpdevelop, but I believe that in the future the project will gradually catch up with visual studio.

    References


    SharpDevelop 3.0 vs Visual Studio Express edition

    UPD: The link above has a good comparison table for two environments, just not everyone follows it.

    Also popular now: