• .NET

    Code. Just Code. JustCode.

    It's my pleasure to announce the youngest member of the Telerik product family - JustCode, a code analysis and refactoring tool. Actually "youngest" is not the most correct word to use because JustCode was born more than 5 years ago but "adopted" by Telerik in March, this year. In March Telerik acquired the JustCode product from the German-based company, Omnicore, and the founders of the company (and also the creators of the product) joined Telerik to help us take the tool to the next level. A few words about the founders of Omnicore; these are brilliant guys with lots of expertise in...
    November 18, 2009
  • .NET

    Code is king or... a new product from Telerik?! Oh, what could it be?

    Well... I like paraphrasing and what has happened before will invariably happen again :) The original phrase is of course Sumner Redstone's "Content is king". But why change it to "Code is king"? Only because this is the content, we, the developers create? Or is it because code is important and we should put more stress on it as developers? Both reasons are valid, but I will focus on the importance of code quality. There are a myriad of articles, blog posts, books, etc. about what defines “good code,” so I cannot add much to this topic. In a few words, I can just say that...
    September 10, 2009
  • .NET

    Saving a few lines of code. Part V - Raising events.

    As you read the title of this post you may ask yourself - Hmmm, raising an event... wasn't that achievable with 1-2 lines of code? How smaller could it get, 0 lines of code? And you're almost right, to raise an event is not such a big deal. Supposing you have an event of type EventHandler. public event EventHandler Clicked;     Typically you have a virtual protected method which raises the event: protected virtual void OnClicked(EventArgs e)   {       if (Clicked != null)           Clicked(this, e);   }    Pretty simple unless you want to be thread safe (well... almost thread safe), then you should add one additional line: protected virtual void OnClicked(EventArgs e)...
    February 03, 2009
  • .NET

    Saving a few lines of code. Part IV - Refactoring switch statements

    Before going into details about how you could refactor a switch statement first I should say that there's nothing wrong with this statement (as with any other C#, VB.NET or whatever statement). Most probably you would want to refactor a switch in one of these scenarios: It has reached a certain amount of lines of code so that you need to scroll in order to see all the cases. When you want to introduce some new functionality you inevitably end up adding new cases to the switch statement. When you implicitly check for a type in a switch statement. In most...
    January 26, 2009
  • .NET

    BDD. Optimizing the stories.

    As I said in my previous post I preferred using tools (StoryQ and NetSpec) to using descriptive method names (those with long names containing lots of underscores). Well, I lied. At first I was convinced that the tools would be good enough for me but as it usually occurs the truth lies somewhere in between. Here's what I have in mind. Let's take as an example the famous sample showing how you could apply BDD when you want to develop the logic for transferring money from a savings account to a cash account. If you use StoryQ you could end up having something like this: [TestMethod]      public void TransferToCashAccount()      {   ...
    January 20, 2009