Geeks With Blogs
Jonathan Starr's Blog Thoughts on C#, Ajax, WCF, LINQ, Agile et al. C#
Coding With Comments
improve my => 'code' Jeff Atwood wrote an interesting post today about Coding Without Comments. If you didn't catch it, he basically says that if a coder uses excellent naming conventions in his code, the code is eminently readable. So the need for comments is obviated. Partly true, I say. But there are significant exceptions to consider. If you have external customers using your code, public methods should have have lots of comments. With summary tags filled so your customer know what the methods ......

Posted On Friday, July 25, 2008 5:48 PM

Code Redundancy is NOT Bad - Part 2
improve my => 'code' I got some responses from a post I made on Saturday, that troubled me. I really think it is important to code to an interface whenever possible - not only to give your application to flexibilty, but to give it testability as well. So I thought I might give you an example. Say I have a class that depends on two other classes I have. In this example, Partitioner depends on SystemIOAdapter and MerchantRecordCounter. jstarr jstarr 2 0 2008-06-23T23:16:00Z 2008-06-23T23:16:00Z ......

Posted On Monday, June 23, 2008 6:26 PM

Code Redundancy Is NOT Necessarily Bad
improve my => 'code' I was just reading Jeff Atwood's recent blog article Department of Declaration Redundancy Department He makes the case that writing code without static typing is easier to read, and "Anything that removes redundancy from our code should be aggressively pursued -- up to and including switching languages." My take is "maybe". Say I have a class named Example that implements two interfaces, IFoo and IBar. When I instantiate I have several options when dong so statically. Example ......

Posted On Saturday, June 21, 2008 5:43 PM

Who Is An Average Developer?
Every blogger I read claims to have superior coding skills, and every place I have worked claims only to hire superior developers. In my current position and in my prior one, my employers say they interviewed more than twenty candidates to fill each position. If that's so, where are the average coders? I heard one theory - they are all unemployed! And they keep trying to get jobs but they can't. So interviewers have a skewed sampling of coders. I will confirm that in my current and previous position ......

Posted On Friday, May 2, 2008 7:24 PM

HttpModule Question
I recently implemented an HttpModule in a web project (.NET 2.0 Framework on Windows XP), and noticed some anomolous behavior... The Init method for the HttpModule does not always fire (sometimes it did however) after the web application started. I used an obvious workaround, and took advantage of the event model exposed in global.asax. But I am disturbed from what I saw. Has anyone else noticed this anomaly? Is this something that can be fixed? Thanks for the help! Jonathan Starr ......

Posted On Tuesday, March 4, 2008 9:21 PM

Saint Louis Microsoft Technology Calendar Updated...
improve my => 'code' I have updated the unified Saint Louis Microsoft Technology calendar here. Here is a quick summary: St. Louis C# User Group 3/10/2008 6:00pm Our guest, live from France, will be Patrick Smacchia, creator of NDepend and author of Practical C# 2 and .NET 2. Sharepoint meeting 3/11/2008 8:30am St Louis Sql Server User Group 3/11/2008 1:00pm Writing better T-SQL Queries, Avoid Cursors and Dynamic SQL CRM User Group Meeting 3/27/2008 8:30am NET User Group Meeting 3/31/2008 5:30pm ......

Posted On Sunday, March 2, 2008 11:19 PM

LINQ and Financial Simulation
improve my => 'code' I just started playing around with LINQ seriously, and I really love some of the features incorporated, like the Enumerable.Range() function and how it can be used for integer programming. Here's a simple function for generating lognormal distributions (could be useful for financial engineering). Hope you're enjoying the samples, Jonathan Starr public List<double> GenerateLogNormalDistributi... numberOfTimes, double mean, double standardDeviation) { Random randomGenerator ......

Posted On Friday, January 25, 2008 8:00 PM

Surprising CLR Behavior
improve my => 'code' The following code (surprise, surprise) compiles. But it does not work as intended (you won't be able to "doSomethingElse()! Can any of you figure out why? (I have my suspicions.) Jonathan Starr using System; namespace test { internal class BaseTest { private int _prop1; public virtual int prop1 { get { return _prop1; } set { _prop1 = value; } } } internal class DerivedTest : BaseTest { public override int prop1 { set { base.prop1 = value; doSomethingElse(); } } } } ......

Posted On Friday, January 25, 2008 4:45 PM

Response to Brainteaser #11?
I have been pretty excited about LINQ, because it seems to do all of the optimization for me for free (kinda like T-SQL). Yow Han-Lee asks in his blog, Brainteaser #11, Given any two large List, what is the quickest way to find the mutual intersection of the two? Now take into consideration memory constraints? Well, the answer that only takes a minute or two for me is the following... Comments welcome! Jonathan Starr using System; using System.Collections.Generic; using System.Linq; using System.Text; ......

Posted On Friday, January 25, 2008 3:23 PM

Beauty.Equals(Truth) ?
improve my => 'code' I noticed an entry on Wikipedia that made me smile. SPL or the Shakespeare Programming Language is, in the words of Wikipedia, "designed to make programs appear to be something other than programs; in this case, Shakespearean plays. " Variables in code are treated like characters in a Shakespearean play. Variables must "enter" to be useable (allocated?) and "exit" to be declare out of scope... And variables speak their mind to output to the console. For instance, [Enter Juliet] ......

Posted On Tuesday, January 22, 2008 1:58 PM

Re-Adding Service References
improve my => 'code' While using Visual Studio 2008, I made the mistake today of dropping and re-adding a WCF service reference. If you do this, not all of the service operations and exposed proxy types are recreated in the References.cs file. If you made my mistake, cleaning the solution (right click on the solution and choose -> Clean Solution) will clear out the problem. And in the future, I will be updating service references instead. Hope this helps you out! Jonathan ......

Posted On Friday, January 11, 2008 5:30 PM

HAI WORLD (LOLCODE)
Apparently people will write compilers for anything... Kudos to the author for exending the CLR for .NET... LOLCODE Compiler Yeah, it's hilarious and hip according to the author... I also say he would be better off without the ALL CAPS coding style ......

Posted On Monday, October 29, 2007 11:05 PM

Automatic Properties in C# - A Critique
improve my => 'code' In the latest release of Orcas, one of the new features provided is "Automatic Properties" which allows developers to use a shorthand like the following: public class Person { public string FirstName { get; set; } public string LastName { get; set; } public int Age { get; set; } } and the compiler knows to interpret this as public class Person { private string _firstName; private string _lastName; private int _age; public string FirstName { get { return _firstName; } set { ......

Posted On Tuesday, January 15, 2008 8:00 PM

Reminder
improve my => 'code' Just a quick reminder to the Saint Louis developers out there. There is another Saint Louis .NET User Group meeting on Monday, January 14th at 2 City Place. Details are here in the updated Saint Louis Microsoft Technology calendar. Hope to see you there! Jonathan ......

Posted On Saturday, January 12, 2008 9:46 PM

1st Instructional Video
I have been helping a friend finish a mobile web application for his new business (www.1CCN.com), and posted below are my first attempts for making instructional videos. Windows Movie Maker (which comes with Vista) was a blast - really easy to use. Any comments are appreciated - btw, we will be adding Ajax to the budget entries tomorrow. Thanks! Jonathan Adding a contact to the Contractors' Collaborative Network Creating a Project in the Contractors' Collaborative Network ......

Posted On Saturday, January 12, 2008 8:55 PM

Size is Half the Enemy
improve my => 'code' I just read Jeff Atwood's post - Size is the Enemy - and I think his contention that Size => Complexity => Bad Application, is partly true. But not entirely true. How does an application become large in the first place? If an application is successful, and is widely adopted, there is a greater chance that the same application may be reused for more purposes than originally intended. To handle the new use cases, custom code is added and we get code bloat. This may be ......

Posted On Wednesday, December 26, 2007 1:49 PM

Unified Saint Louis Calendar
I started the following unified calendar for Microsoft technology meetings in the following calendar. Note that the first events posted are in January, 2008. Meetings include Saint Louis Microsoft Sharepoint, CRM and .NET Meetings... Feel free to add to the calendar (I will be try to maintain this as well). View Saint Louis Microsoft Technology Meetings calendar Enjoy, Jonathan Starr ......

Posted On Monday, December 24, 2007 12:04 AM

Shameless Plug
My good friend, Rick Troupin, has his web / mobile phone application business (1ccn.com) up, and I urge all of you involved in the construction business to check it out! His application allows users to manage projects using our phones or through web access. You can break down projects into smaller pieces (WBS structures) and maintain status on each piece. It's really a very sophisticated application, and a small log entry does not do justice to the application. Of course, his application is built ......

Posted On Saturday, December 15, 2007 12:35 PM

Check this out - Scott Guthrie posted on this blog!
So very cool... One of my favorite bloggers (and developer/manager extraordinaire), Scott Guthrie, posted a response on my blog. Looks like he really cares about the Visual Studio 2008 Beta 2 Release (and it does not go unnoticed here.) Anyway, I will hold off writing about Silverlight until it becomes available. Thanks again, Scott. Jonathan ......

Posted On Monday, November 19, 2007 10:14 PM

Visual Studio 2008 Beta 2 - This really is cool!
improve my => 'code' Wow.... made my first WPF application in seconds flat on Beta 2. Now when you create a button on the form, you can double click it to make it's event handler, and code right in the contents. And even more important, the compilations are lightning fast now... Here's my first application - a Fizz Buzz game (must have beer on the brain). The XAML <Window x:Class="FizzBuzz.Window1" xmlns="http://schemas.micro... xmlns:x="http://schemas.mic... ......

Posted On Monday, November 19, 2007 8:56 PM

Visual Studio 2008 Beta 2 is here!
Just downloaded and installed on my machine. It took forever to install... Seriously, I saw this picture without any updates for over twenty minutes on my 2GB RAM machine. Anyway, I can't wait to get me some Silverlight, and maybe spin the tires on WPF (as this version is supposed to be much more stable)... Hopefully I will have some time to share my experiences with you here soon. Happy coding, Jonathan ......

Posted On Monday, November 19, 2007 8:16 PM

My My MyGeneration Baby...
improve my => 'code' Okay, I admit it. I don't like to use generation software tools - mostly because I know I can always do it better by hand. Also, cut & paste seems to be the most error prone way to write software - you end up writing everything twice that way. In my latest project, however, the sheer volume I had to write and test in a short period of time had me scrambling to use UltraEdit, Visual Studio Macros, Visual Studio snippets - everything but the proverbial kitchen sink - to ......

Posted On Monday, November 19, 2007 7:03 PM

Ever want to add regions to your .NET code quickly?
improve my => 'code' I do this quickly now with a free tool from Meridium made available by the good people at CodeProject.com (1000 Thanks) http://www.codeproject.com/... Follow the directions to install (I appreciate the fact that the tool works without problems with Resharper), and just click on the method for which you want to add regions, and type <control> + d. It even tries to add comments, but will not interfere with you previous comments made (nice!) The ......

Posted On Sunday, November 18, 2007 3:52 PM

InternalsVisibleTo - Useful .NET Attribute...
improve my => 'code' .. though it is not very well documented. I have found it very useful to expose internal interfaces for unit test projects in order to initialize many types of objects at one time (when they all implement the same interface). Of course, I did not want to switch over the access modifier for the interfaces every time I wanted to run unit tests, so I used the InternalsVisibleAttribute This attribute can also be very useful for types you want to expose to your own assemblies, ......

Posted On Sunday, November 18, 2007 3:42 PM

Another Enumeration Helper Function
improve my => 'code' Before I posted a method that converts from one enumeration to another by value... Here's one that does the conversion by string (by the enumeration name)... public static class EnumHelper { public static int ConvertEnumToEnumIntByStrin... U>(U enumArg) { string [] arrNames = Enum.GetNames(typeof(T)); int[] arrValues = (int[] ) Enum.GetValues(typeof(T)); for (int counter = 0; counter < arrNames.Length; counter++) { if (arrNames[counter] == enumArg.ToString()) { return ......

Posted On Tuesday, October 23, 2007 4:22 PM

Enumerating all of the namespaces and their respective classes in an assembly (dll).
improve my => 'code' I wrote some code in a test project, and then had to list all of the namespaces I used in my project for a manager so they could conform to a standard for production... As I used more than 50 namespaces for my test project, I wanted to do this automatically... Also I wanted to show all of the classes contained in each namespace... Anyway, I used the following code... Thought this might be useful to others... (If someone reading this sees a good way to refactor this, it would ......

Posted On Monday, October 22, 2007 1:27 PM

Converting One Enumeration to Another Enumeration
improve :my => 'code' This came in handy for me, and I thought others might feel the same way... Say you have one enumeration used as arguments for a method, and you created a simplified enumeration to override the original method to create a method that is easier to consume... Example: public enum XTypes{ PFM = 0, STAT = 1, YIELD = 2, RANK = 3 } and public enum XTypesSimplified{ PFM = 0, STAT = 1 } You can use the following to convert one into another. public class EnumHelper { public static ......

Posted On Wednesday, October 17, 2007 6:54 PM

Starting at Reuters - Very Excited
I noticed that Bill Evjen ( http://geekswithblogs.net/e... ) and Kevin Grossnicklaus ( http://geekswithblogs.net/k... ) had started blogs, and they are very prominent managers at Lipper (in Saint Louis, Missouri) which is a division of Reuters ... I thought some of the readers out there may be interested in contributions from someone more junior than these two titans of tech. First off, the interview process at Lipper was impressive. Bill Evjen and two other developers ......

Posted On Tuesday, September 25, 2007 7:39 PM

Copyright © Jonathan Starr | Powered by: GeeksWithBlogs.net