Geeks With Blogs
George Mamaladze .NET C# tips, tricks, tweaks. Effective use of data structures and algorithms. Clean code. .NET Framework
Tiny UML Sequence Diagram Markup Language for Agile Developer Documentation
I hate overdocumented software components and frameworks. There are top 3 reasons for that: Only the code tells the truth(programmer.97things.o... The good component expresses it’s intended way of usage through good structure, expressive naming. Ideally it is designed the way which does not allow wrong usage. Any documentation tends to became outdated. Reading such a documentation can be misleading and frustrating. And finally, to be honest, who ......

Posted On Thursday, May 3, 2012 6:34 PM

Parallel Programing, PLINQ and Globalization
I’m going to start with a simple code snippet which sorts an array of strings using LINQ. 1 IEnumerable<string> line = new[] {"Z","A","Ä"}; 2 var result = line.OrderBy(letter => letter); 3 Console.WriteLine("{0}", string.Join(" ", result)); The result might look like this: A Ä Z … or not. It depends on the thread culture the sorting is running in. The string order is culture aware (unlike char order which is culture invariant), so if we switch for instance on one of the Norwegian cultures ......

Posted On Tuesday, August 9, 2011 6:15 AM

Edulinq an excellent LINQ+TDD guide
Recently I stumbled across a question on about Edulinq. Its a series of blog posts turned at the end into a free eBook. Downloaded to my eBook reader and had a lot of fun in subway. There where not to much to discover inside of LINQ for me, but it could help a novice to understand the LINQ “magic” and use it efficiently. Another very important point for me was the test driven approach. You could take this book as a guide for test driven design and development. Reading this book ......

Posted On Monday, August 8, 2011 10:03 PM

"Cancel me if you can" or PLINQ cancelability & responsiveness in WinForms
Download Source Code Challenge Just had the first chance to apply PLINQ (Parallel LINQ) to the real task. When I am playing around with some new technology everything works fine, the real understanding comes along with challenges in a real use case. Currently I am working on application which processes large amount of text data gathering statistics on word occurrences (see: Source Code Word Cloud). Here what the simplified core of my code is doing. Enumerate through all files with *.txt extension. ......

Posted On Tuesday, August 2, 2011 10:37 AM

Why .NET LinkedList does not support Concat and Split operations?
Why .NET LinkedList does not support Concat and Split operations? Download SimpleLinkedList source code Concat O(1) or O(n) ? The .NET LinkedList is a circular doubly linked list, where each node holds a reference to its previous and next nodes. The last node’s next is the head node and the head node’s previous is the last one. Linked lists are attractive because of O(1) insertion and removal operations. Instead of shifting elements in array you just chain nodes in appropriate order and that’s it. ......

Posted On Monday, July 18, 2011 12:55 AM

yield – Just yet another sexy c# keyword?
yield (see NSDN c# reference) operator came I guess with .NET 2.0 and I my feeling is that it’s not as wide used as it could (or should) be. I am not going to talk here about necessarity and advantages of using iterator pattern when accessing custom sequences (just google it). Let’s look at it from the clean code point of view. Let's see if it really helps us to keep our code understandable, reusable and testable. Let’s say we want to iterate a tree and do something with it’s nodes, for instance ......

Posted On Saturday, February 5, 2011 3:04 AM

Back to the roots: .NET binary search and the meaning of the negative number of the Array.BinarySearch() return value
Back to the roots: .NET binary search and the meaning of the negative number of the Array.BinarySearch() return value Recently I gave a group of developers a task witch can be simplified to following simple problem: you have a sorted array of elements; find the index of a given element in this array. They came up with following solution: //given array int[] sortedArray = new[] { 1, 5, 8, 12, 18, 20 }; //Create a list from the array List<int> list = new List<int>(sortedArray); //use IndexOf ......

Posted On Tuesday, February 2, 2010 12:57 AM

C# Tweaks - Why to use the sealed keyword on classes
C# Tweaks - Why to use the sealed keyword on classes The sealed keyword is one of the very seldom used modifiers in C#. Probably most of you know what it is for, but only several developers ever used it. See C# Programmers Guide if you are not sure you remember what the keyword is good for: Why shell I use it? Most popular, but not really most important motivation is the performance - JIT compiler can produce more efficient code by calling ......

Posted On Monday, February 1, 2010 5:26 AM

Copyright © George Mamaladze | Powered by: