Monday, February 04, 2008

The one newsletter that arrives in my inbox that is bound to perk me up anytime is from http://www.sqlservercentral.com/. It is sort of an older style newsletter but the contents are great. The editorials (yes, there are editorials) are also great. The main articles might not be right for me at the time but then there is the question and the community-submitted help code as a featured script.

Monday, February 04, 2008 9:18:20 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 

In response to the previous posting. A few weeks ago, I would certainly have solved this the same way that you did in "OldSchool" with the exception of using IEnumerable<string>. Why limit your code to just string arrays? Now that we have LINQ, we can get pretty fancy! Technically one line within the method but I split it up to aid readability.

 

static void Main(string[] args)

{

    string[] names = new string[] { "Andy", "Marcy", "Cindy", "Jennifer", "Aaron" };

 

    Console.WriteLine(NewSchool(names));

}

 

static string NewSchool(IEnumerable<string> list)

{

    return list.Aggregate(new StringBuilder(),

        (sb, n) => sb.Length == 0 ? sb.Append(n) :

         sb.Append(",").Append(n),

        sb => sb.ToString());

}

 

And for even more fun, I built a simple test harness for each of these three methods. The test: 10000 itterations where I concatenate a string array that contains 8192 elements. Junior ran 36 minutes and 41.5 seconds*. OldSchool ran 8.453 seconds. NewSchool ran 9.484 seconds. NewSchool is likely slightly slower than OldSchool because of the use of the delegate. * I was only able to run 100 itterations on Junior which ran 22.015 seconds. I then extrapolated from there. The actual result would likely be even longer given its use of memory.

Andy | LINQ
Monday, February 04, 2008 1:23:04 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 

Creating a comma delimited string from an array came up yesterday, here is a couple of methods, one from our junior developer and one that I did.  I entitled mine old school, because of the C coding that shaped my programming.

static internal String Junior(String[] list)
{
    String output = String.Empty;

    foreach (String item in list)
    {
        output += item + ",";
    }

    output.TrimEnd(',');

    return (output);
}

static internal String OldSchool(String[] list)
{
    StringBuilder output = new StringBuilder();

    foreach (String item in list)
    {
        if (String.IsNullOrEmpty(item))
            continue;

        if (output.Length > 0)
            output.Append(",");

        output.Append(item);
    }

    return (output.ToString());
}

Which one do you like?

{6230289B-5BEE-409e-932A-2F01FA407A92}

 

 

C# | Wayne
Monday, February 04, 2008 10:21:22 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  | 
 Friday, February 01, 2008

This presentation was given by Brad Wilson and James Newkirk, Microsoft. I sat in on Brad's Pair Programming Agile presentation at the first Seattle Code camp which I enjoyed alot. The first code camp had more Agile presentations. Apparently Agile is no longer the shinny new toy because there was only one presentation on saturday in that area. James has been with xUnit, since some part of it's JUnit days, through NUnit and now the new version of XUnit. He went through the history which explained some of the wierdness the process has had. He also went through a discussion of what they were concerned about when they decided to build a new TDD framework. It was nice to hear real world examples of bad logic or implementation. My favorite they mentioned was using the framework for code coverage. Code coverage is the process make making sure every line of code is executed. The idea being that the more executed code that goes through testing, the fewer bugs the release product will have. These two said that blank tests or non-functional nUnit tests were created in some environments they saw just to reach code coverage percentage requirements. The only place I have ever seen code coverage as a metric for quality was microsoft while working as a tester on OLEDB.  They wrote issues on the board people wanted to cover and they covered all of them. Very impressive.

During the code samples and execution, it was obvious these two preferred TestDriven.Net over any other runner of the framework.

I had to feel for the guy that asked about UI testing. He obviously didn't know anything about TDD. In response, the discussion for UI testing covered watiN.

Other linkable names mentioned during the discussion:

MBUnit

CruiseControl

Windows Presentation Foundation

Jeremy Miller

 

 

 

 

.net | Dina
Friday, February 01, 2008 8:41:08 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 

I have several reasons not to use open source and I will be posting all in short order.  By open source, I mean a free assembly I can get on the web that includes the source, usually a development tool that is build by a group of people.

For some time I have been debating weather to use open source projects for my C# programming, or to buy professional components.  By debating, I mean thinking about, trying, and experimenting with both -- however now it is time to put my ideas to paper and share.  Disclaimer: in a year I might change my mind, or a posted comment might change my mind.  However here is one tought to chew on:

We reference assemblies so that we can gain functionality without having to code the funtionality ourselves.  Microsoft provides some great functionality in the CLR and it allows us to make significant gains in productivitiy by not making up write the stuff in the CLR.  However, if Microsoft is missing the functionality and it isn't specific to your vertical or product -- there is a tendency to get the functionality from the web as a open source project.  I tend to get the source, recompile it and make it a project within my solution, instead of using the assembly already compiled -- this can be a whole other discussion.  Ok, to recap: I reference an assembly from the Internet because I don't want to write the code myself.

However, it is my experience that the open source projects are very buggy, which leaves me fixing them to get them to work.  Which means I am coding in someone elses code just to get the thing to work correctly.  If I purchased a professional product, I could just write customer support, provide a reproduction, and get a fix.  Which leads me to reason #1: There is no support, I would rather buy (and I mean have my company buy) a $1000 per license product and get support for bugs then fix and worry about the open source.  

Just to drive the point home, even popular projects like ICSharpCode.SharpZLib have bugs, I just fixed three of them.  And, no I am not going to submit the changes to the open source project -- it takes to much time, they will not like my changes (since I patched it and didn't fix it like I would my own code), and usually those developers are hard to reach (hiding from doing customer service) and snobby (not SharpZLib in paricular just open source developer in genderal).

{6230289B-5BEE-409e-932A-2F01FA407A92} 

 

Friday, February 01, 2008 8:54:09 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  | 
 Thursday, January 31, 2008

This was Wayne Berry's presentation about real-world crypto coding for web sites. The presentation was identical to his asp.net user group presentation. He stayed calm with 15 minutes of Digipen equipment not working and two room switches. But it was a great presentation and the level of detail and code was just right. He said he will post the presentation here at some point.

.net | Dina
Thursday, January 31, 2008 1:08:13 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, January 30, 2008

This presentation was given by Zlatko Michailov & Asad Khan, PMs, Microsoft ADO.NET. The best thing said in the entire presentation was that if your model is well built you shouldn't have to do any group bys or joins. Drink the kool-aid, swallow the pill, enjoy that illusion in a real-world situation. Especially some piece of $%^@ database that is mission critical and the data is 10 years old, not normalized, and some one else's baby. But if you are going to dream, dream big, right?

Their blogs can be found at: http://blogs.msdn.com/esql/. E for entity. Why be normal? right?

 

 

.net | Dina
Wednesday, January 30, 2008 1:03:54 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, January 29, 2008

Rod Paddack gave this session wearing a great geek shirt. His enthusiasm for open source was reciprocated by many in the audience. Here is the list:

Mentions during session included http://code.google.com/

What are your top tools?

 

.net | Dina
Tuesday, January 29, 2008 12:54:50 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 

Charter Communications officials believe a software error during routine maintenance caused the company to delete the contents of 14,000 customer e-mail accounts.

http://www.foxnews.com/story/0,2933,325338,00.html

I am glad today that I didn't do this and force my company to give a $50 credit to each customer.  Ouch.

{6230289B-5BEE-409e-932A-2F01FA407A92}

Tuesday, January 29, 2008 9:11:44 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, January 28, 2008

From https://seattle.codecamp.us/ 

Jonathan Carter, Microsoft Developer Evangelist, gave an introductory talk about the Entity Framework which has just had a Community Preview release. It is basically a middle layer framework driven by Domain Driven Design for creating and extending objects on top of a data source. The data source presented was SQL Server but you could imagine all sorts of layers. There are two parts, the Entity Model and the framework for asp.net. A simple but nowhere complete comparison could be drawn to CodeSmith. Open Visual Studio, create a "file". You are asked for a data source and data objects to include. The framework displays an Entity Relationship diagram which you can dink with to create the objects the way they will work for the upstream code and not the downstream DB.

While the presentation was a tad buggy, the framework looks like it is going someplace cool.

The best part was the intellisense to your objects you just created via the framework as well as the underlying data. This was best represented by a URI demonstation to get at the data - similar to a web service test page. Type in your URI for an object called customer with a customerid of 23 to get the Title of the customer: http://server/page.x?customer(23)/Title/ displays the result.

 

Community Preview Download http://www.microsoft.com/downloads/info.aspx?na=47&p=3&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=e9ba57aa-2a27-4658-ad04-4380a2df836c&u=details.aspx%3ffamilyid%3dD8AE4404-8E05-41FC-94C8-C73D9E238F82%26displaylang%3den

ADO.NET Team Blog http://www.microsoft.com/downloads/info.aspx?na=40&p=1&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=d8ae4404-8e05-41fc-94c8-c73d9e238f82&u=http%3a%2f%2fblogs.msdn.com%2fadonet%2f

.net | Dina
Monday, January 28, 2008 12:22:43 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  |