Monday, June 22, 2015

My Journey Into New Territory: C#, Roslyn and APIs

    I've been trying to teach myself C#, mostly by playing the Code Hunt puzzles to learn its differences from C and C++, and writing basic programs. I did this in the name of speedy learning- something I previously considered my forte. As it turns out, this isn't a good way to get a solid foundation in any language, so writing more detailed code in C# for my research tasks has been rough. I've had to go back and relearn everything I've known about functions, objects, classes, overloading, and file i/o from C and C++, because besides the C in it's name, there isn't much in common with the other languages I know. The sunny side, however, is that I have now been exposed to completely new methods and system calls that implicitly perform a whole bunch of operations. I am now confident that when dealing with advanced tasks, C# has my back. I've also had to learn about file and directory manipulations, and from navigating and searching directories to creating and writing files I've gotten a lot of insight into the workings of installer packages. My conclusion is thus: C# is pretty neat. I think I'll make it my default language.
    In the past weeks I've had to learn about APIs, a new topic for me. An Application Program Interface, consists of building blocks for software. APIs determine connections and compatibility between software components, and you use them to create graphical user interfaces. An API gives you a set of routines and you make calls to the API to do what you want. They are used in just about every website you love, from Google Maps and YouTube to Twitter and Amazon. The API I will be using is the Code Hunt REST API, which essentially provides core data from the website, for example data from users such as their experience, and number of attempts for a given level. Every programmer is going to come into solid contact with APIs, so this is a very important experience. I'm going to get my hands dirty with the Code Hunt API as soon as I can figure out what calls I can make to it, and just how it can work with a compiler.
    When I first began coding I came across the .NET Compiler Platform known as Roslyn, a compiler platform for C# and Visual Basic. Because it's compilers come with APIs for code analysis, it will be a very useful tool in the weeks ahead. It is only available on Visual Studio 2015, so if you intend to use it, you have to download and install VS 2015 Community or Enterprise(Community is free but Enterprise costs $$$). I plan to use it to parse the user code obtained from the Code Hunt API. Looking at sample code that shows how the two work together is quite daunting. I can hardly get a sense of which calls are to the REST API and which code is for Roslyn. I will have to test the sample code to find out which is which. That will be my exploration for the immediate future. I'll let you know what I find.

No comments:

Post a Comment