Friday, June 17, 2011

.NET Certification - Only as good as you make it.

I am currently trying to get an MCP with the ASP.NET 3.5, 70-562 exam.  I have already passed the Application Foundation exam last June 2010 but have just not had the time to study for the next exam enough to take it.  I have started studying more lately and am planning on taking the test in the next few months.  The way I study for the exam is to read the book, then take the practice tests and study from that.  I first take the tests that come with the book in study mode. While doing this I go to MSDN and study in depth all objects that are asked in the questions.   Sometimes I willl spend several hours on one quesiton. Doing this you will pass the test and you will actually learn something in the process.  This brings us to another point and the purpose of this article.

People have mixed feelings about certifications.  They say just because someone passes the tests does not mean they can actually program and solve real world problems.  I completely agree with this and if you hired someone just based on certifications then that is your own error.  Would you hire someone just because they have a masters degree in Computer Science?  If you did you might find out they don't know how to program in your environment or up to your expectations at all.  It is always best to interview based on real world questions derived on things you use in your environment.  If you miss doing this incompetent people will slip through the cracks and become employees.  I am not a hiring manager but I have often participated in  technical interviews on the hiring and being hired sides of the table. 

Friday, June 10, 2011

.Net Application Evironment Configuration - How do you move through environments?

Environment configuration, what I mean by this are your settings that allow your application to run in the different environments it needs to run in.  Development, QA, Production etc...

This is an ever changing entity where I work.  We use a custom Microsoft Enterprise Library implementation to store connection string and credentials.  We use .Net config files for almost everything else.  We also have some third party tools we use for configuring console applications with command line parameters.

I have come up with a very nice method that uses custom sections in the config such as below:

<Environment>
                 <add key="CurrentEnvironment" value="1"/> 1=local, 2=dev, 3=qa 4= prod
</Environment>
<local>
                <keys....
</local>
<Dev>
               <keys....
</Dev>
ETC.....

Then we setup a class with properties that allows you to pull from the custom sections or use the appSettings section for items that don't change between environments.  We then define properties in the class that expose all of the keys in the config file and it is transparent when we use the properties whether they are environment specific or common.

At build time, in the build scripts we use, we create a new build for each environment and change the XML in the config file to set the CurentEnvironment for the correct build target.  So far this has been working fine and we use built in .Net configuration methods to access config file values.  This has proven more stable than using custom XML configuration files and cache objects.

Please feel free to leave comments or suggestions if you have better methods of configuring your applications for different environments.

Wednesday, June 8, 2011

C# Extension Methods Really Do Exist - Are there Extension Properties?

I learned about this sometime ago in Javascript and I thought it was a brilliant feature.  Well today I just learned it was also available in C#3 and above.  Sometimes my blindness amazes me and I cant believe I did not see this sooner given I used in it javascript about 6-7 years ago.

Well here is the MSDN link for extensions.
http://msdn.microsoft.com/en-us/library/bb383977.aspx

Example:
namespace ExtensionMethods
{
    public static class MyExtensions
    {
       public static int WordCount(this String str)
        {
            return str.Split(new char[] { ' ', '.', '?' },
                             StringSplitOptions.RemoveEmptyEntries).Length;
        }
    }  
}


string s = "Hello Extension Methods";
int i = s.WordCount();


This syntax really allows you to write cleaner code.  Extending the built in .net objects is just as easy as adding new methods to your own classes.  I have seen people mentioning extending properties on forumns but Im not really sure if that is possible or they were just complaining about it.  I will need to research that a little further.  1 person mentioned he would like to do something like the following with extension properties which I think would also be nice to have.
DateTime d = 20.Minutes.Ago

Tuesday, June 7, 2011

Porting Applications from HP Tandem Nonstop to Windows - Large Software projects.

I am currently working on a very large software project at work.  This project is a goverement mandated change that is affecting a large part of most of the systems I work on. 

I am currently building 4 new components as part of my change with several of the changes being ports from a HP Tandem NonStop environment to the our Windows environment.  They are porting these applications due to most of the new functionality being written in WCF and it is just much faster to process the new component on Windows than to link in from Cobol programs to the WCF service.  Other issues are most of the new databases are on the Windows side so again it is just faster to do the processing on Windows.

It really seemed like once they made the decision to move the first process to Windows it opened the flood gates.  They quickly started moving applications that they were having problems designing solutions for on the NonStop to Windows where the solutions were almost trivial. 

This is not the first time I have gone through these excercises.  Actually it seems like I have been going through this type of effort ever since I started working on software.  It really seems to go through phases.  Every few years they will decide it is time to make the leap.

To Transfer or Redirect is the Question.

While studying for a Microsoft certification 70-562 I ran across this explination.  I never really dug down into what either of these did so here are the basics.

Server.Transfer performs server-side redirection, which minimizes the delay in displaying the page by not requiring the client to make an additional request. Set the second parameter to True to pass the query string parameters to the new page.

Response.Redirect performs a client-side redirection, which requires an additional response and request, slowing the display of the new page.