A few days ago I was reviewing some old code that I had written a while back, and I found that I was having problems scanning the code quickly to see what it was supposed to do. After a couple a minutes, I realized that a number of areas in the code we're a little more verbose and confusing than they needed to be. The primary reason behind this: no generics. I know generics have been around for a while, and I have just gotten used to having them around. They make it much easier to deal with collections of objects in a type safe, and easy to follow manner.
Sure, before generics you could make things work, but in many cases I found myself having to cast object to a type, that I knew they we're. Now with generics, I just don't even worry about it. Everything just works, and that's good.
A place to put all of my random thoughts about software development and computer programming.
Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
November 30, 2010
November 23, 2010
ASP .NET Chart Control
I recently needed a chart in one of the asp .net website I've been working on. In the past I've never been able to find a satisfactory solution that was free or inexpensive. I was pleasantly surprised to find out that in Visual Studio 2010 and .NET 4.0, that Microsoft included new chart controls for ASP .net and for Windows forms. I figured that since they we're free and already included in C#, I might as well try them.
At first glance they appear to be pretty decent. The control includes most of the basic features that you would expect: multiple chart types (bar, line, pie), multiple series, 3D capabilities, legends. It also has a number of other features that we're well beyond what I was expecting for a free solution: advanced statistical calculations, and over 12 different categories of chart types.
My needs for the project I'm working on are very simple, so after a few minutes of looking at some examples (4 Guys From Rolla was a great starting point), I was up and running. Within a few minutes I had a basic line charts working, and shortly after that I had the legend, labels, and multiple series all working as well.
So far from what I've seen, these chart controls seem to work pretty well, even if someone had some intensive charting needs, these free chart control might still fit the bill. Definitely worth a look before buying anything to fill your charting needs.
At first glance they appear to be pretty decent. The control includes most of the basic features that you would expect: multiple chart types (bar, line, pie), multiple series, 3D capabilities, legends. It also has a number of other features that we're well beyond what I was expecting for a free solution: advanced statistical calculations, and over 12 different categories of chart types.
My needs for the project I'm working on are very simple, so after a few minutes of looking at some examples (4 Guys From Rolla was a great starting point), I was up and running. Within a few minutes I had a basic line charts working, and shortly after that I had the legend, labels, and multiple series all working as well.
So far from what I've seen, these chart controls seem to work pretty well, even if someone had some intensive charting needs, these free chart control might still fit the bill. Definitely worth a look before buying anything to fill your charting needs.
November 18, 2010
C# Lambda Expressions
For quite a while now I have been wondering about lambda expressions. I've started seeing more and more of them in code examples, and there has obviously been a lot of talk about them. But most of the examples I've seen have not been very intuitive. I finally decided to see what they we're all about, and was surprised about how simple they are to understand. They are not really anything new, just a new shorthand for doing things that C# could already do.
I started my journey be reading chapter 11 of Pro C# 2010 and the .NET 4 Platform
(As a side note I've read a number of the other chapters, and it looks like a decent book so far.) I thought it was interesting that lambda expressions we're grouped in the same chapter as delegates and events, but after reading the chapter, it all makes sense now. This is probably oversimplifying it, but lambda expressions are just "syntactic sugar" for creating anonymous functions, and working with delegates. They allow a developer to easily write a basic inline function for event handlers or anywhere else a delegate is needed.
The basic format for lambda expressions is arguments => statement. The expressions can have 0 or more arguments and 1or more statements. The most common case I've seen is probably one argument and one statement, and the nice thing about a single statement is that the result of the statement is the "return" value of the expression. One of the other great things about lambda expressions is that in most cases the parameters can be implicitly typed, so that can mean a few less characters to type, and simpler, easier to understand expressions.
I still don't know how often I will use them, but it is nice to know how simple they are and how easily I can define event handlers now. What would have taken a significant amount of boiler plate code and definitions and a function, can now be done in a single, quick line of code.
I started my journey be reading chapter 11 of Pro C# 2010 and the .NET 4 Platform
The basic format for lambda expressions is arguments => statement. The expressions can have 0 or more arguments and 1or more statements. The most common case I've seen is probably one argument and one statement, and the nice thing about a single statement is that the result of the statement is the "return" value of the expression. One of the other great things about lambda expressions is that in most cases the parameters can be implicitly typed, so that can mean a few less characters to type, and simpler, easier to understand expressions.
I still don't know how often I will use them, but it is nice to know how simple they are and how easily I can define event handlers now. What would have taken a significant amount of boiler plate code and definitions and a function, can now be done in a single, quick line of code.
November 2, 2010
ASP .NET Web Forns vs. MVC
I've used ASP .NET web forms for a number of years on some of the websites I've worked on. Recently I've been looking into MVC more in depth, to see if it is something that I should start using. It seems like most people are very adamant, that one approach or the other is the only way to go. Very few people seem to believe that both approaches are valuable.
I have Pro ASP.NET 4 in C# 2010
but it only briefly covers MVC. The only book I've seen that looks reasonable on MVC is Pro ASP.NET MVC 2 Framework
, does anyone have any feedback on this book or recommendations for other resources. I'm looking for something that covers basics, but also covers overall design concepts and principals to use in real life applications. Most of the internet resources that I've found just touch on brief topics, but nothing seems to really cover MVC holistically.
I've also been wondering if MVC 3 has anything substantial that I should hold off for. Most people seem to agree that MVC 2 is the first usable version of the framework, is version 3 significantly better?
I have Pro ASP.NET 4 in C# 2010
I've also been wondering if MVC 3 has anything substantial that I should hold off for. Most people seem to agree that MVC 2 is the first usable version of the framework, is version 3 significantly better?
November 2, 2009
ASP .NET Model View Controller
Recently I've started looking into ASP.NET MVC
. Over the last few years I've become pretty familiar with standard ASP .NET, so I've wanted to see what Model View Controller has to offer. At first glance it seemed to address some of the shortcomings of standard ASP .NET, and gives the developer more control of the HTML that is output to the browser. Because of the architecture, the code can be much easier to test as well.
The biggest shortcoming I've seen is that there are not many built in components, so not only can you control the HTML that is output, it appears that you have to do it manually. One of the really nice things about ASP .NET has been the ability to drag and drop controls that, in most cases, just work out of the box. For the development that I've done this has been a tremendous time saver. Until I see something promising in this area, I probably won't look too much as using or switching to ASP .NET MVC.
The biggest shortcoming I've seen is that there are not many built in components, so not only can you control the HTML that is output, it appears that you have to do it manually. One of the really nice things about ASP .NET has been the ability to drag and drop controls that, in most cases, just work out of the box. For the development that I've done this has been a tremendous time saver. Until I see something promising in this area, I probably won't look too much as using or switching to ASP .NET MVC.
October 24, 2009
C# 4.0 and Visual Studio 2010
I've started looking into C# 4.0, Microsoft .NET framework 4.0, and Visual Studio 2010, hoping there will be some cool new features that I will like. I've done very little with some of the new features of .NET 3.0 and 3.5, and didn't notice much new with Visual Studio 2008. Here are some of the things I've seen that look intersting:
- Parallel Extensions for the .NET Framework: Now that most computers have 2-4 processors it is become more apparent that parallel programming will be going mainstream. Instead of being relegated to high end scientific and business applications on large supercomputers and distributed systems, every day programmers are going to need to know and use techniques for parallel programming. These extensions look like they are a step in the right direction. When combined with solid software development practices, these can get a developer headed in the right direction to be able to easily take advantage of the multiple cores available in computers today.
- C# optional parameters: One thing that I do miss from C++ is finally making it's way to C#. I can't count the number of times that I have had to create multiple different variations of a function, just to be able to mimic the capabilities of optional parameters. What could be 3 or 4 functions with slight variations in parameters, can now become a single method definition. Easier to maintain, easier to use, and much more convienenient. Plus by allowing named arguments, you don't even need to specify all parameters from left to right, you can pick and choose which parameters you want to set, when yo call the function.
- Static ID's for ASP .NET controls: I've always wondered why Microsoft decided to enforce their control naming on all ASP .NET developers. I could understand if the naming standard was the default, because it does enforce that all of the names are unique, but we are finally getting a way to specify the name we want. This will make my like so much easier, especially for JavaScript code and forms post-back. With multiple nested master pages and containers, the length and complexity of names for controls is ridiculous. I've actually had a few cases in JavaScript that I've had to create a lookup variable to map my usable names to the actual control names.
- Dynamic Programming and Dynamic Variables: I have to admit that I haven't done anything with the dynamic languages and features that already exist in .NET, and I don't intend to start now. I tend to prefer the enforced structure and design of normal development, but it is nice to know it is available if I want to give it a try.
October 17, 2009
Code Profiler for .NET
I've always been interested in profiling my C# code. Years ago with .NET 1.1 I used the DevPartner Profiler Community Edition, which is no longer available. Ever since then I have been unable to find a good free or open source solution for profiling .NET code. I know that there are some decent commercial products out there, but I'm cheap and I don't the tools often enough to merit purchasing them.
Is code profiling just not in demand? It seems like if enough people were interested in the value of profiling, then there would be at least one decent open source solution. For me it has been fun on occasion to really dig deep into an algorithm that I'm working on. Trying to eek just a little more performance out of it. I've found that disassembling the code also helps to see what is actually happening behind the scenes. One of the nice things about profiling .NET code is that you don't need to instrument the code manually. When I used the DevPartner ProfilerProfiler I just picked the options I wanted and clicked go. After running the application I could delve into the details of which functions were being hit the most, and even which lines of code were consuming the most time. It can be a challenge to tune the performance of an algorithm or an application, but it can be rewarding to the code double in speed, or even more.
Hopefully I'll be able to find a good open source code profiler to "get my fix" on performance tuning my code.
Is code profiling just not in demand? It seems like if enough people were interested in the value of profiling, then there would be at least one decent open source solution. For me it has been fun on occasion to really dig deep into an algorithm that I'm working on. Trying to eek just a little more performance out of it. I've found that disassembling the code also helps to see what is actually happening behind the scenes. One of the nice things about profiling .NET code is that you don't need to instrument the code manually. When I used the DevPartner ProfilerProfiler I just picked the options I wanted and clicked go. After running the application I could delve into the details of which functions were being hit the most, and even which lines of code were consuming the most time. It can be a challenge to tune the performance of an algorithm or an application, but it can be rewarding to the code double in speed, or even more.
Hopefully I'll be able to find a good open source code profiler to "get my fix" on performance tuning my code.
October 13, 2009
C# vs. C programming
For quite a few years now I've been working primarily with C# and Microsoft .NET, and I have to admit that even with it's shortcomings I would list them as my preferred programming language and development framework. I will admit that there are still cases where C and C++ are better/faster/etc., but overall I find that when I use C# I'm more productive, my code has fewer errors, and it is easier to maintain.
At my current job I get to work in both worlds. Most of the newer software we write is in C#, but we still have a pretty expansive set of libraries and applications that are in C++, we even have one that is in managed C++ (which has it's own set of problems). I always prefer working on the C# side of things, and even dread working with some of our C++ applications.
I know that for most people this is an almost religious topic, and I don't want to come across as a zealot, I just have my preferences. I've used C++ quite extensively and it is a great language, but C# builds on the long history of C and C++ and adds more than a few nice features. And since it is built on a decent framework (.NET) there is a greater consistency to code. When you change jobs in a c++ environment, you probably have to learn a new set of frameworks. Some companies use in house libraries, some use boost, and others use something else. With C# most of the basic framework pieces come built in. There will always be a need for other frameworks beyond that, but .NET comes with most of the necessities.
There are many other features and helpful things that come with C# and .NET, but my overall view is that when I use them, I am more productive overall, and that is money in the bank to me.
At my current job I get to work in both worlds. Most of the newer software we write is in C#, but we still have a pretty expansive set of libraries and applications that are in C++, we even have one that is in managed C++ (which has it's own set of problems). I always prefer working on the C# side of things, and even dread working with some of our C++ applications.
I know that for most people this is an almost religious topic, and I don't want to come across as a zealot, I just have my preferences. I've used C++ quite extensively and it is a great language, but C# builds on the long history of C and C++ and adds more than a few nice features. And since it is built on a decent framework (.NET) there is a greater consistency to code. When you change jobs in a c++ environment, you probably have to learn a new set of frameworks. Some companies use in house libraries, some use boost, and others use something else. With C# most of the basic framework pieces come built in. There will always be a need for other frameworks beyond that, but .NET comes with most of the necessities.
There are many other features and helpful things that come with C# and .NET, but my overall view is that when I use them, I am more productive overall, and that is money in the bank to me.
September 24, 2009
Sporadic ASP .NET AJAX errors
I've got a website that is having very sporadic ASP.NET AJAX
errors. I have a JavaScript logging solution that reports back to me when any JavaScript
errors occur on my web pages. There are two errors that occur most frequently are ['Type not defined] and ['Sys' not defined]. These both are objects defined by the .NET AJAX extensions. It appears that in some cases (probably 1% or less) these types fail to initialize. The issue occurs on Internet Explorer 6, 7, and 8. The only way I have been able to reproduce this error is forcing the first ASP .NET JavaScript file to not load. Should I just chalk this up to sporadic internet hiccups? Most of the issues related to this that I've seen in my internet searches are errors that occur constantly because of misconfiguration, but my site works almost all of the time and only has issues occasionally.
The other odd error is that I have is AJAX calls back to our server that fail to return all of the data. The HTTP header indicates one size for the data, and the actual text returned is considerably smaller, anywhere from only 10% to half, and even a few that returned 0 bytes. And this is after accounting for the fact that the data is UTF8 encoded. I have always assumed that if the AJAX call returns, and readyState property is 4 and the status is 200 then the data being returned should be correct, accurate, and complete. This error seems to be across all Internet Explorer versions and I've even seen it with Firefox
. Has anyone seen any issues similar to either of these, or have any suggestions as to how to debug this?
The other odd error is that I have is AJAX calls back to our server that fail to return all of the data. The HTTP header indicates one size for the data, and the actual text returned is considerably smaller, anywhere from only 10% to half, and even a few that returned 0 bytes. And this is after accounting for the fact that the data is UTF8 encoded. I have always assumed that if the AJAX call returns, and readyState property is 4 and the status is 200 then the data being returned should be correct, accurate, and complete. This error seems to be across all Internet Explorer versions and I've even seen it with Firefox
April 23, 2009
Graph Visualization/Interaction
I'm been trying to find a good open source C#/.NET library for graph visualization and manipulation (Not charts/graphs, but graphs as in Computer Science graph theory/nodes/edges.) I have come up pretty empty handed. I'm trying to find a way to visualize and interact with a state machine library that I have. So I just need basic nodes and edges, both with labels and color, and automatic layout algorithms. I've looked and looked and come up empty handed, the best I could find were:
P.S. Just in case anyone is wondering, I did consider using Windows Workflow Foundation
for our state machines, but they seemed way to heavyweight, and since it sounds like they are rearchitecting the system for version 4.0 (To finally get it right hopefully?). I decided to steer clear.
- QuickGraph, which didn't seem to have any useful interactive capabilities, and depended on other libraries/code for displaying graphs.
- NodeXL which seemed to be primarily excel based (who does that?), but did have a library component, but didn't seem to be able to even label edges of graphs.
- Netron which seems to have existed once as open source, but is now something else (The website is very unclear about what/if they are selling), there is an older version of the open source code that has lots of components, but it doesn't appear to be geared toward library use.
- Piccolo2D seemed promising, but also seemed to not support labeling edges, and also seemed more oriented towards alternate UI design than simple graph display and manipulation.
P.S. Just in case anyone is wondering, I did consider using Windows Workflow Foundation
February 26, 2009
UML and struggles with Visio
I've started working on a new project and were trying to design everything properly from the ground up. I've got a rough high level system architecture in place, and now I'm trying to do more detailed design of the individual components of the system. I haven't used formal UML
much in the past, so I'm trying to force myself to learn and use it for my class documentation. After some rough sketches on paper and whiteboards. I have tried using Visio
to create the diagrams. This has not gone well. Visio seems to force a very strict form of UML, if there is some sort of informal notes, or attributes I want to add, it is almost impossible.
Also it seems that everything you add to the diagrams has to be done through the properties dialog boxes. Why can't I just get a box with three sections, and type what I want. That would seem to be so much easier. Maybe the other method formalizes the UML (and maybe it could be used for generating classes?) but it seems like way to much overhead.
I guess I need to look into other ways to do this with Visio, or even look at some other tools for UML. Maybe a good open source tool?
Also it seems that everything you add to the diagrams has to be done through the properties dialog boxes. Why can't I just get a box with three sections, and type what I want. That would seem to be so much easier. Maybe the other method formalizes the UML (and maybe it could be used for generating classes?) but it seems like way to much overhead.
I guess I need to look into other ways to do this with Visio, or even look at some other tools for UML. Maybe a good open source tool?
February 4, 2009
Silverlight with ActiveMQ and NHibernate
I'm getting ready to start on a new application that I want to write using Silverlight
. Current I use ActiveMQ
as a messaging bus between applications and services. I would like to do the same for Silverlight, and avoid WCF
, so that I only have one service architecture to maintain. I have not seen much on using thewe to technologies together. The best I have found is a few messages about compiling NMS against a beta version of the Silverlight runtime. Appears that things almost work, and may work now. Has any one seen anything newer or something actually working?
I also use NHibernate
as an ORM solution. Same issue, trying to find people that have been able to sucessfully use these 2 technologies together. Once again, not a whole lot of reliable looking things. Some rumblings about LINQ, which seems to indicate that it would work. But nothing obvious.
I also use NHibernate
Labels:
ActiveMQ,
C#,
NHibernate,
Silverlight,
software development
January 28, 2009
NHibernate
Lately I've been working on a new data access layer. The new project is for some C# code that I work on, so we decided to use NHibernate
. I've been doing some research and playing with NHibernate. First thing is that the actual NHibernate site is not the best place to go for up to date documentation. I'm using NHibernate 2.0, but most of the documentation is specific to 1.0, and doesn't always work in 2.0. After some searching (more than was necessary, since I would expect something like this to be easy to find), I found another site: NHibernate Forge. It has content that is more updated, especially the main reference documenation.
So far everything seems to work pretty well. A few little things I have stumbled on:
NHibernate has great logging, but it can be overkill as times. I decided to limit the log4net appenders, so that the NHibernate logs didn't overwhelm the rest of the logging. Since I use multiple different apps that all use the same configuration for log4net, I setup the logging programatically, instead of trying to maintain identical logging config files for each. This can make it a little harder to set up loggers, but I stumbled on how to do this as well.
I was also trying to look into NHibernate transactions, and the possibility of nested transactions using savepoints. I use these in some of my other code to deal with certain error cases where some things need to be rolled back, but not an entire transaction. It seems that this doesn't really work well with NHibernate. Because of the tight coupling between the data objects in memory and the database, rolling back part of a transaction could leave the in memory objects in an inconsistent state. Fortunately in most cases this will be OK, but it is nice to be able to use the savepoints in some cases.
I think I've worked out most of the details for what I need, I'm just trying to create some lightweight wrappers around NHibernate, to give me an abstraction layer between NHibernate and my code. Hopefully everything will be smooth sailing from here on out.
So far everything seems to work pretty well. A few little things I have stumbled on:
NHibernate has great logging, but it can be overkill as times. I decided to limit the log4net appenders, so that the NHibernate logs didn't overwhelm the rest of the logging. Since I use multiple different apps that all use the same configuration for log4net, I setup the logging programatically, instead of trying to maintain identical logging config files for each. This can make it a little harder to set up loggers, but I stumbled on how to do this as well.
I was also trying to look into NHibernate transactions, and the possibility of nested transactions using savepoints. I use these in some of my other code to deal with certain error cases where some things need to be rolled back, but not an entire transaction. It seems that this doesn't really work well with NHibernate. Because of the tight coupling between the data objects in memory and the database, rolling back part of a transaction could leave the in memory objects in an inconsistent state. Fortunately in most cases this will be OK, but it is nice to be able to use the savepoints in some cases.
I think I've worked out most of the details for what I need, I'm just trying to create some lightweight wrappers around NHibernate, to give me an abstraction layer between NHibernate and my code. Hopefully everything will be smooth sailing from here on out.
December 2, 2008
Visual Studio vs. NUnit unit tests
I've used NUnit
over the last few years at a few jobs to do unit testing in C# code. At my current job we started trying to use the unit test features of Visual Studio 2008
. We had been using NUnit but we needed a solution that would work with our new C# code, as well as testing our existing legacy C++ code. The C++ code we have is primarily unmanaged cross platform code that is used in both Windows and Linux applications.
Everything we had read indicated that the Visual Studio unit testing didn't work very well with unmanaged code. At first this seemed true, but we have been able to work around this well enough by just simply setting project settings to allow executing mixed mode code.
One of the biggest issues has been trying to debug into unit tests that are throwing exceptions. Because the unit tests are managed code, and most of the code being tested is unmanged, almost all of the exceptions come across as SEHExceptions. This can make it more difficult to determine what is going on, but can be overcome by going to Debug->Exceptions and checking some of the exceptions to break the code when the exceptions are thrown.
Other than that, the biggest concerns I've had with the Visual Studio unit test system is that they seem to have been over-engineered (Microsoft would never do that, right?). Pretty much everything seems to have been copied from NUnit, except it is harder to use. Just trying to determine how to run a specific test or tests is a pain. NUnit is just very simple and easy to use.
So far everything is working OK, and at least we have one solution that works for both C# and unmanaged c++ unit tests, but I still miss the ease and simplicity of NUnit.
[Update: 2/6/2009]
We decided to use Visual Studio unit test for C++, but after more debate decided that NUnit is a far superior solution. It just works and it works well. Visual Studio works, but not as well and not as easily.
Everything we had read indicated that the Visual Studio unit testing didn't work very well with unmanaged code. At first this seemed true, but we have been able to work around this well enough by just simply setting project settings to allow executing mixed mode code.
One of the biggest issues has been trying to debug into unit tests that are throwing exceptions. Because the unit tests are managed code, and most of the code being tested is unmanged, almost all of the exceptions come across as SEHExceptions. This can make it more difficult to determine what is going on, but can be overcome by going to Debug->Exceptions and checking some of the exceptions to break the code when the exceptions are thrown.
Other than that, the biggest concerns I've had with the Visual Studio unit test system is that they seem to have been over-engineered (Microsoft would never do that, right?). Pretty much everything seems to have been copied from NUnit, except it is harder to use. Just trying to determine how to run a specific test or tests is a pain. NUnit is just very simple and easy to use.
So far everything is working OK, and at least we have one solution that works for both C# and unmanaged c++ unit tests, but I still miss the ease and simplicity of NUnit.
[Update: 2/6/2009]
We decided to use Visual Studio unit test for C++, but after more debate decided that NUnit is a far superior solution. It just works and it works well. Visual Studio works, but not as well and not as easily.
Labels:
C#,
C++,
software development,
unit testing,
Visual Studio
July 31, 2008
Amazon web services
I wanted an excuse to write some code. Seem like I never get any chances to write fun stuff anymore. So I decided to look into the Amazon associates program and put together a simple application for browsing books. It's pretty basic and just shows the amazon book categories and sub categories, with the 10 most popular books in each category.
Hopefully I'll get some more time at some point to flesh it out a little bit, but who knows. At least I think I have all of the bugs worked out.
Hopefully I'll get some more time at some point to flesh it out a little bit, but who knows. At least I think I have all of the bugs worked out.
May 29, 2008
Developer Efficiency (C# vs. C++)
Ever have one of those nights where you can't sleep. Sometimes me brain will not stop thinking so I can fall asleep.
Lately at work I have been working on adding new features to our companies web site. We recently rewrote the site in C# and ASP .NET which has been wonderful. I've been able to use C# for the past 6 years or so, and overall find it better than Java, C/C++, and any other language I know for general purpose programming. Other languages may have some better features than C#, but overall I prefer C#.
Unfortunately most of our code base is in C++. Every time I have to go back and work in our old code base I feel like I hit a brick wall. I just feel so much more productive and effective when I use C#. Before everyone starts yelling about the merits of C++ let me clarify.
Also I find it much easier to move from one project to another and one company to another when using the .NET framework. The .NET framework includes most of the standard features/classes/functions I need on a daily basis. It doesn't have everything, but close enough for most things. With C++ there is the STL, but beyond that different companies use different libraries for everything else, and often write some of their own libraries. If we hire a developer familiar with C# I know that they should be right at home in our new C# code base, because most of what we use is already in the .NET framework. If we need someone for C++ then we either make sure that already know all of the different 3rd party libraries we use, or we assume it will take them a while to get up to speed. Regardless they will have to get up to speed on our in house C++ libraries.
From both a technical and managerial standpoint I am glad we are moving more and more towards C# and away from C++.
Lately at work I have been working on adding new features to our companies web site. We recently rewrote the site in C# and ASP .NET which has been wonderful. I've been able to use C# for the past 6 years or so, and overall find it better than Java, C/C++, and any other language I know for general purpose programming. Other languages may have some better features than C#, but overall I prefer C#.
Unfortunately most of our code base is in C++. Every time I have to go back and work in our old code base I feel like I hit a brick wall. I just feel so much more productive and effective when I use C#. Before everyone starts yelling about the merits of C++ let me clarify.
- Our C++ code base is not very well organized or designed
- I have much more experience with C# (Though I'm not a C++ novice either)
- The added features/power of C++ are not worth the extra complexity most of the time
Also I find it much easier to move from one project to another and one company to another when using the .NET framework. The .NET framework includes most of the standard features/classes/functions I need on a daily basis. It doesn't have everything, but close enough for most things. With C++ there is the STL, but beyond that different companies use different libraries for everything else, and often write some of their own libraries. If we hire a developer familiar with C# I know that they should be right at home in our new C# code base, because most of what we use is already in the .NET framework. If we need someone for C++ then we either make sure that already know all of the different 3rd party libraries we use, or we assume it will take them a while to get up to speed. Regardless they will have to get up to speed on our in house C++ libraries.
From both a technical and managerial standpoint I am glad we are moving more and more towards C# and away from C++.
Subscribe to:
Posts (Atom)