Monday, January 13, 2014

Is Windows a good development platform?


    I've had a conversation with my colleague couple days ago about is Windows a good platform for development or not. I was frustrate with some of MS software at that point, I was arguing that even though developers are the power of Windows as a platform, they were never treated as good, as in Linux (or Mac now).
    On one hand, Windows has arguably best in class IDE for C/C++, C#, Visual Basic - Visual Studio. Note, it's only three out of dozens of main stream languages. And by been closed to external expansion - they didn't implement system like Eclipse, where others can add support for other languages. Now, is that would add a lot of work for MS developers - not really, if they architected VS in the right way - it's already pluggable system (they have number of different languages, with different syntaxes - it just makes sense to have abstract system, where each language is an add-on), so it's just a matter of sharing this API (and yes, supporting it in next versions).
    Having different programming languages in Visual Studio brings me to next step - you project configuration and build scripts. Each project is not just a set of files with code, but also what compiler to use, flags for the compiler and linkers in different configurations, external libraries and resources required and etc. Now, Visual Studio organizes all this in XML file, which presumably is human readable and editable (XML is not a good format for this anyway - too much text is just too much text). But compare a 4 configuration setup, when in that XML you will have 4 sections of pretty much the same text, except may be couple flags absent or present and CMake, where it's organized as common block and if blocks with specifics of each configuration. Now when you want to edit only release - you will need to go through two same blocks and find what you need in a pile of options, or find appropriate if RELEASE and change options there. This continues with external libraries and etc (it's really pain adding an library even from Visual Studio, because you need to remember to select all configurations, as if adding library to only one is a default case everybody needs).
    Ok, for example, we got our C++ project up and running and checked into repository. Called up a colleague and asked to add a feature to it... Oh wait, they just got a new machine and need to install environment. Can we help him somehow? Not really, only give bunch of links to download ton of software and wait until they click through hundreds of wizards. Note, that we just need a (clean) clone of our environment on different machine, but there is really (except using VMs) no way to just give him a setup script, that would install everything automatically. Hey, that's a day he will not be able to return to his life.
     So our colleague installed everything, but our project doesn't compile on his machine. He looks and finds out that he installed third party library of incorrect version and to incorrect path. Because it actually asked where to install it - why there is no specific place, where libraries are installed? And yes, we didn't specify version, because how would we do it - only add version number to the folder it's installed, again manual and pretty complicated to keep track and update later. Simple install script, that would install required versions would save time and make sure of appropriate version and place. Now we institute a special place for libraries to be put or even include them in repository to make sure versions are the same for everybody and go on, but feeling that this OS doesn't know what any developer will need still left.
     Switching gears, we were asked to write a web scrapper. Of cause you can try to do it in C#, but that will be overkill - number of lines of code you will write is just insane compared to scripted languages. So our choices are Perl and Python. We go with Python - and again everything starts - download Python, install by clicking on a wizard. This time no Visual Studio to back you up - so open Notepad... oh, wait, the default editor is just nightmare. How for the love of god default editor can be that bad? Anyway, download Notepad++ (again wizard, click-click, time is passing by). Python has great system to install required libraries, which in Linux/Mac works like a charm. It works in Windows, until you need to compile some C/C++ code for it. How is it possible that no one man figured out how to compile programmatically their code when Visual Studio installed from Python. It works well with GCC, but I've tried multiple times, including figuring out code that does compilation with Visual Studio and failed to configure it right. No, there is precompiled packages you can download and install (wizard, click-click) and from what I understand they are compiling them with MinGW (prove me wrong).
    Client who asked about web scrapper - asked to save everything to MySQL database. We need to install it (you know it - wizard, click-click), we need to configure it (UTF8 by default, different port and etc) - quest to find where configuration file is, because who looked at where that mysql asked us to install itself. Ok, now how is our colleague or where we deploy our code will have same environment? Again, write a document where to download everything, and attach a config file to that document.
     Concluding, both *nix and Windows platforms have their positive and negative sides. Linux has a lot of development awareness just because developers is a huge user base, and any developer can have a say at how it should be. I wanted to point out that Windows, as OS should be much more aware of this issues and open to help developers to do their job better and easier, and in result spread MS products. Instead, by been not really helpful in a lot of this details it repeals them. Now days, Mac OS by been easy to use from one hand and actually having a lot of Linux flexibility (*nix file system, bash scripting, MAC ports and Homebrew to install packages) grows as a primary platform where development is been made. Of cause another trend is developing web application, when you just connect to a server and write code there. Windows by having only graphics remote desktop requires much higher bandwidth, which not always available. In result, it's Linux who shines, by providing powerful text-based IDE in addition to great development environment.