5 Things I Hate about my Favorite Programming Language: C#

In episode 73 of the StackOverflow podcast , Jeff Atwood mentions one of his favorite questions to ask developers, “What are 5 things that you hate about your favorite programming language?”

It got me thinking. I definitely like some of the language features of C#, especially when developing within Visual Studio. Some of my favorites are Generics, Intellisense, and Short-Circuited conditionals. However, there are other pains that I encounter repeatedly when it comes to language syntax.

 

  1. In C#, there is the nifty syntax of following a variable with “??” allowing the developer to specify a replacement value in the case of the variable being null. In theory this is a great feature. However, I never end up getting to use this and I imagine that is the case for most developers. I find I usually end up using the “?” and “:” syntax because I typically want to use a member of the null object like “user.Identity.ToString()” but I have to check if “user” is null or I will get an object reference error.
  2. Why do I always have to lookup how to format a DateTime object in code without the minutes?
  3. If “ToString()” is a member of every object, why should I have to explicitly call it when setting the value of a string variable from another non-string variable? As an example, why can’t a string value be inferred from my int variable by just calling “ToString()” when there would otherwise be a type issue?


    int i = 0;

    string j = String.Empty;

    j = i;

  4. The compiler considers the use of “=” valid within an if condition. This can be confusing and often causes accidental issues where “==” is the intended code. As a solution, I use a coding standard of typing the constant value to be compared first because it cannot be assigned to (i.e. “if (0 == count)”).
  5. Nullable types seem like a great idea but they are not always intuitive. In the example below, the code seems like it should work. However, I receive a compiler error on the second line.


    int? i = null;

    i = (sender != null) ? sender.GetHashCode() : null;

 

Most of the above complaints were compiled off the top of my head. If you have found a better way to leverage the C# language so that you do not run into these issues, please share them with me in the comments. Perhaps it is my mis-use of the language features that has caused my agony.

Advertisement

Analyzing my Choice of Attending Ohio State

It’s that time of year

We are into the heart of college football season which means I have a date with the television every Saturday around noon to watch my Buckeyes. Can I blame the inconsistency in my blog-posting schedule on football season? I suppose so, but I made a 2010 football season resolution to not make stupid excuses.

In spending so much time thinking about the Buckeyes football team, visiting campus, and discussing school among friends I have recently begun to reflect upon The Ohio State University and whether or not it was the best choice of college for me. While in school, I generally knew that those would be the best days of my life. Ohio State meant a lot to me and I had even gone as far as referring to it as “the Greatest University in the World.” Looking back, it was definitely an excellent choice, but could I have done it better?

To properly analyze the decision means to review the benefits and drawbacks to my personal career and education situation.

The Great

Let’s start out with the obvious. Ohio State has an elite athletics department. At the time of this writing, it is one of the few universities to win a Division I championship in each Baseball, Basketball, and Football and is the reigning 5 time Big Ten Conference football champion. Although it may not seem important in supporting my career, the prestige of the program has made it convenient to connect or keep in contact with fellow alumni. I have yet to meet a fellow Ohio State graduate who did not care about the direction of the football program, providing for a useful icebreaker.

Speaking of alumni, did I mention the sheer size of Ohio State’s Undergraduate class? It is routinely ranked in the top 5 in the nation, sometimes as high as 50,000 students enrolled. Such a high number of students yields a high number of alumni, many of whom have taken jobs at leading companies or have established networks in remote locations. Fellow alumni are more likely to network and pull favors than some other successful stranger.

(OSU alumni have a tradition of taking pictures of this O-H-I-O formation in exotic locations)

(The Columbus Skyline – by voteprime)

With Ohio State being as huge as it is it must accommodate a wide range of needs. The University offers diverse majors, libraries, science & computer labs, and recreational facilities. Essentially, if you can think of a resource that should be available for students, you will be able to find it somewhere on campus. The problem is that many students do not realize what is available until it is too late. Perhaps a more specialized school would not run into this issue.

When I attended OSU, it was ranked respectably in its Computer and Information Science (CIS) department. The program provided a fundamental knowledge of theoretical computer science concepts. According to this site, Ohio State’s Engineering & IT ranking is 157 in the world.

A subtle benefit to Ohio State is the location. Although Columbus, OH does not boast many geographical advantages (it is flat with limited bodies of water), its development has been well-planned and it is of considerable size. Contrasting Ohio State with other schools, like Ohio University, which is clearly the primary attraction of its city, residing in Columbus enables students to find quality careers, co-ops, and interests without traveling a great distance.

The Disappointing

I am proud to be a Buckeye and I still live in Ohio. However, I would like to think that I am objective about the school’s educational program. In my time on campus and afterward, I have met some truly elite individuals. Unfortunately, the curriculum is not as challenging as it is at prestigious academic institutions. Therefore, the average undergraduate student is not very motivated. To draw on a previous point, students at Ohio State have incredible opportunity for success due to vast resources, but in order to take advantage of opportunities requires serious self-discipline.

During my early years at Ohio State (99-01), it was disappointing to realize that the school was more well-known for “riots” than for any of its brilliant research. It seemed as though any off-campus party involving multiple houses quickly turned into an angry mob throwing beer bottles at COPs. Going to class the next week I could hear the frustration in my professors’ voices that their hard-work had translated into negative national headlines.

My biggest regret about choosing Ohio State involves the aforementioned limited geography. Ohio State is located in Columbus, Ohio, right in the middle of the Midwest. The following big cities are within a 3 hour drive: Detroit, Indianapolis, Cincinnati, Cleveland, and Pittsburgh. While convenient for those wanting to visit 5 NFL teams within a short drive, it is not exactly close to any technology hotspots such as San Francisco, Seattle, Boston, nor even Chicago. Additionally, the region lacks exciting recreational activities. There are no beaches, mountains, nor warm days in November. If I could search for colleges again, my new strategy would be to at least research gorgeous campuses in exotic locales. I have heard Pepperdine University is one example of such a beauty as opposed to the “concrete campus” that was my destiny.

 

Having graduated and entered the workforce, I look back on my decision to attend Ohio State with satisfaction. Although there were some drawbacks, its size helped me stretch my capabilities socially and introduced me to a vast network of professional connections. I wouldn’t be the same person if I were not a Buckeye.