An extra tip to make you a better ASP.NET developer – level 200

I’d like to add an extra tip to make you a better ASP.NET developer:


  • Don’t use the designer for anything more than the most trivial control-placement tasks.  The designers are geared toward RAD development.  That rhyms with “BAD”.  If you get v1 of software out with RAD, each subsequent version will be worse and worse maintenace-wise.  For those who’ve felt the pain, you agree with me.  For those newer to development, RAD seems great.  Drag and drop, and call the database from code-behind. . .and it works.  Don’t take my word for it.  Do some self-study.

  • One more tip:  Study material BESIDES MSDN material.  MSDN sells RAD, after all.  .Net 2.0 – do the same thing with 70% less code!! 


8 Tips to make you better ASP.NET developer


A nice list of tips, plus links to other good resources.




Ramping up with NAnt for automated builds – level 300

At first glance, the NAnt .build files may seem daunting, especially the really long ones, but the documentation for NAnt is superb!

I wanted to start with a real VS solution instead of the trivial HelloWorld .cs file, so I used my Model-View-Presenter demo solution.  Since this was a Visual Studio solution, all I had to do was add a Solution task in the build file.

Here is my build file.  Now if that doesn’t convince you that automated builds aren’t that hard, I don’t know what will!

<project name=”Model View Presenter with Repository” default=”rebuild”>
    <property name=”configuration” value=”release”/>
   
    <target name=”clean” description=”Delete all previously compiled binaries.”>
        <delete>
            <fileset>
                <include name=”**/bin/**” />
                <include name=”**/obj/**” />
                <include name=”**/*.suo” />
                <include name=”**/*.user” />
            </fileset>
        </delete>
    </target>
   
    <target name=”build” description=”Build all targets.”>
        <call target=”build.solution”/>
    </target>
   
    <target name=”rebuild” depends=”clean, build” />

    <target name=”build.solution”>
        <solution configuration=”${configuration}” solutionfile=”MVPWithRepository.sln” />
        <property name=”expected.output” value=”View/bin/${configuration}/View.exe”/>
        <fail unless=”${file::exists(expected.output)}”>Output file doesn’t exist in ${expected.output}</fail>
    </target>
   
</project>

Rode my bicycle from Houston to Austin this weekend – level SORE

Last weekend, I participated in the MS 150 bicycle tour from Houston to Austin to raise money for the MS Society.  It’s a crippling disease for which there is currently no cure.  I’m really sore, but I’m glad I did it.  This is the second time I’ve done it, and I averaged 15.3 miles through the full 180 miles in two days.

If you’d like to donate to the MS society in my name, just follow this link: http://ms150.org/edon.cfm?id

This is the first year that there was a Texas A & M riding team, and we had a blast.  We had 75 members, and Saturday night in La Grange, we woke up the campgrounds with an Ol’ Army yell practice.  I look forward to next year and an even bigger Aggie team.

My brother took a lot of pictures and some movies. 

Getting started with ReSharper by JetBrains – level 200

I’m a bit behind the curve on this one, but I’m now developing with the 30 day trial of ReSharper by JetBrains.  I haven’t even tried all of the features.  There are keyboard chords and hidden features I need to learn.  The obvious ones are code-formatting and general helping you out.  It will close your braces, parens, quotes, etc.  It color codes different types of members. 

As I get more into Agile development methodologies, I’m trying to leverage more tools in order to be more productive. 

Vote for Birds of a Feather sessions for Tech Ed. – level 000

If you haven’t already voted for BoF sessions, go there!  http://www.msteched.com/cfp/bofvoting.aspx

I submitted the following:

Agile Methodologies With
.Net

I have to look hard to find fellow developers using Agile
methodologies with .Net projects in my area. Wouldn’t it be great to talk about
how others are using Agile? Also, the next version of MSF will have an Agile
track, and this would be an excellent forum for discussion.

Intended
Audience: Developer
Submitted By: Jeffrey Palermo, Dell, Inc.

Step by Step: Create java package and import to use with C# – level 300

Yesterday I explained
that I was able to import java .jar packages for use with .Net
.  Here’s the
steps.

First, here is my sample Java class.  (Don’t put this in VS.Net, compile this
with the java compiler):

    1 package
ClassLibraryInteropTest;
    2 
    3 public class Calculator
    4 {
    5    
public int
Add(int first, int second)
    6     {
    7         return
first + second;
    8     }
    9 
   10    
public int
Subtract(int first, int second)
   11     {
   12         return
first – second;
   13     }
   14 
   15    
public int
Multiply(int first, int second)
   16     {
   17         return
first * second;
   18     }
   19 
   20    
public float
Divide(int first, int second)
   21     {
   22         return
first / second;
   23     }
   24 }

This is just a sample calculator that I will leverage at the end with my C#
code.  I’ll need to compile this, so I’ll run:

javac Calculator.java

This will create a Calculator.class file.  Next I’ll package that class into
a .jar file:

jar cvf Calculator.jar *.class

This will take all the class files in the directory and put them in
Calculator.jar.  I only have one class, so I’m good to go.  Now, I’ll run JBImp,
with is a .Net utility, to convert the .jar’s Java bytecode to MSIL:

jbimp /t:library Calculator.jar

And you’ll see the following output:

Microsoft (R) Java-language bytecode to MSIL
converter version 1.1.4322.0
for Microsoft (R) .NET Framework version
1.1.4322
Copyright (C) Microsoft Corp 2000-2002. All rights
reserved.

Created
ClassLibraryInteropTest.Calculator.dll

Now I have my .Net assembly named ClassLibraryInteropTest.Calculator.dll. 
Note that the utility used the package name (defined internally) to prefix the
assembly name.

Next, create a .Net project to use as a test harness, and add a reference to
this newly created .dll file.  Once you have referenced it, you’ll be able to
use the following C# code:

    1 using
System;
    2 
    3 namespace
JavaInterop
    4 {
    5     class
Tester
    6     {
    7         [STAThread]
    8         static
void Main(string[] args)
    9         {
   10             ClassLibraryInteropTest.Calculator
myCalc = new
ClassLibraryInteropTest.Calculator();
   11             Console.WriteLine(myCalc.Add(23,
7).ToString());
   12            
Console.ReadLine();
   13         }
   14     }
   15 }

If you get an error running this code (cannot find assembly Calculator),
rename the assembly: ClassLibraryInteropTest.Calculator.dll to Calculator.dll. 

You get full intellisense about all the methods of the Calculator class, and
essentially, you treat it exactly the same as .Net code because the JBImp
utility actually makes it a .Net assembly.

Import existing Java .jar files to .Net .dll files for use with any .Net project – level 400

If you have existing .jar files from a Java application, and you need to use
that existing business logic or rewrite it, wouldn’t it be nice if you could
just leverage the existing package? 

You can with the JBImp utility. 
I recently had to do this, and it was a breeze.  I ran the utility on my .jar,
and out came a managed .dll that I subsequently referenced and used in my .Net
app.

According to the documentation,
the utility actually converts the Java IL to MSIL at the bytecode level.  It
sure did make the reuse picture a lot prettier.

Coding IS design – level 200

I’ve had extensive conversations with people about the phases of
development.  Some say the “construction” phase of a software product is
coding.  I contend that construction is actually compiling and deploying and
that everything before that is design that gets more specific with code being
the language of specific component design, and the code spells out exacting
specifications so that the compiler can appropriately construct the software
product.

So many managers in the industry have tried to reduce coding to construction
where they seek programmers who will work for what seems like hourly wages to
just “construct” the product as set forth by the designer or architect.  Maybe
sometime in the future, it may be like that, but it could only happen if the
software designers designed it completely.  In other words, the architects would
need a language far more specific than UML to design every detail of the
software.

Up to this point, the only way to design the software down to the last detail
is through code.  No design or modeling language currently can come close to
designing lower-level details.  It requires code to accomplish this, and the
coders should be just as skilled as the designers or they will have a hard time
implementing the holes in the high-level design.  Diagrams are great, but if the
coders are not highly skilled, the implementation of the code won’t fulfill the
spirit of the design and will soon become an unmaintainable mess if it even
works in the first version.

From personal observation, I don’t see this situation being rectified. 
Business managers continually come up with root cause analysis as to why it went
wrong.  They will never _discover_ that the problem is they refuse to pay what
it takes to get _good_ coders to make their software, so in the end, the company
will pay more every 5 years or so to completely replace the application that has
become unmaintainable.  The managers responsible for this waste are shielded
from accountability, of course, because of frequent corporate reorganizations. 
The first version of the software gets the job done, and the pretty UI shields
observers from the true state of the code beneath.  The design diagrams look
good in a project managers portfolio even though the software doesn’t look
anything like them.  By the time the software because unmanageable, and a
project takes off to replace the old application and “do it right this time”,
several managers have come and gone, and “no one is to blame”.  The new manager
will make a Version 1 application in the same fashion, get promoted, and several
managers down the line will repeat the same series of events.

The above is my observations from talking with others at other companies.  My
company does a better job at this (thank God), but I hear of so many other
companies where people forget the mistakes of the past and repeat them all over
again.  We, as an industry, have a lot of maturing to do.

Patterns: Provider vs. Plugin vs. Strategy – level 300

Previously I
made an implementation and called it the Provider pattern
.  After some good
discussion, I must redefine what I implemented.  I implemented something that
had major traits of Provider, Plugin, and Strategy.  I implemented a Repository
class that used a configuration service to get the assembly and type of the
class to load.  This class loads the appropriate type that implements my
interface.  My implementation implements every element of Provider except that
instead of an abstract base class for contract, I use an interface.  That breaks
the definition.  Strategy is defined as using interfaces, but in my
implementation uses a configuration item to dynamically load the concrete
implementation via reflection, so I’ve added something not explicitly not
defined in the pattern.

I have a feeling that our vocabulary is getting a bit muddled because we now
have pattern names from different sources, and they overlap quite a bit.  I
don’t feel that I can use a pattern name:  I have to define it first so that
fellow developers know what I really mean.

Perhaps as our industry matures more, a common vocabulary will truly
emerge.