Monthly Archives: May 2004

Sassy B’s ASP.NET Jambaroo

About 3 months ago I made the decision to dump “classic” ASP / VB COM in favor of Microsoft’s spankin’ new ASP.NET.

In a short while I have picked up VB.NET and C#, and become quite familiar with most of the common framework components. While there is a lot to cover, I’ll give you my overall impressions of the framework and the toolkit.

Firstly, it’s important to note that ASP.NET is a quantum leap over ASP/COM. While ASP/VBscript was/is effectively a crippled programming language for novices, .NET gives an experienced dev a lot of nice tools.

The jury is still out on whether ASP.NET really offers much over JavaBeans and JSP or PHP. Obviously these are not easy comparisons, as each has it’s own strenghts and weaknesses. I will say, without a doubt, that ASP.NET offers very little that is not already available in other web app platforms. What it does offer, however, is a bit more polish, and a bit more completeness, and a bit more ease-of-use, especially for novice web devs.

ASP.NET’s maligned and misunderstood event model is actually a nice feature, especially once you begin re-using user controls. Simply put, you can encapsulate the logic of a form in a user control, nest those controls in a page, and the aggregated events will all fire based on the parent’s events. This is very slick, and allows for some quite profound code re-use.

ASP.NET is also an interesting beast, offering a simple XML template system on top of ‘codebehind’ script. While this does a good job of separating presentation from logic, it is somewhat primitive and simple when compared to SMARTY (PHP) or Velocity / Freemarker (Java). The simplicity and ease-of-use with ASP.NET limits it’s ability to do things like dynamically load templates and nest templates. While this is possible by overriding some .NET base classes, it’s expected that ASP.NET 2.0 will have some sort of robust templating, called ‘Master Pages’.

VB.NET is an update of VB 6 and is now a completely OOP language. A lot of the nasty idiosyncracies of VB have been cleaned up. Problem is, there is really no longer a compelling reason to use VB for anything – because you have C#. Many of us seem to agree that VB.NET is the endgame plan for Microsoft to drop VB 6 support. I would guess that 90% of VB programmers will never make that leap, and will spend their careers trapped in the VB 6 ghetto Microsoft has created.

C# is a great little language. With stonger typing and faster execution than VB, it’s C/Java style syntax is a lot cleaner and less verbose. I have moved all my new projects to C# and thus far have had excellent results. If you can write Java or C/C++, and you know OOP, you will have no problem learning C#.

Finally, the .NET class libraries. The .NET lib is huge and has basically everything. The ASP.NET classes contain a vast amount of utility controls, and functionality like HTTP servers, I/O filters, logdaemons, and other such niceties for a server dev.

Now, on to the knocks. Hey, it wouldn’t be a Microsoft product without some serious flaws, right?

First up is Visual Studio.NET 2003. For 900 bucks I expect the HTML editor to work. Unfortunately, it sucks. They used the Frontpage HTML gen libraries! Remove the WYSIWYG form tools, and the big giant productivity gains go right out the window.

Next up, many of the supplied ASP.NET controls, especially the Datagrid, suck. There are numerous gaps in their functionality which essentially defeat their usefulness. Example – you cannot set a querystring with multiple parameters without resorting to mingling program code in template.

Finally, despite all the talk about ‘Managed Code’, many, many of the .NET classes are just wrappers around existing, sucky COM objects. Imagine my joy when I discovered that System.Web.Mail was really just good ol’ POS CDONTS in disguise.

In conclusion:
ASP.NET is an excellent package, and goes a long way towards redeeming Microsoft as a developer tools company. Yes, there are flaws, but the overwhelming sophistication of this toolkit is quite impressive. While it does compare favorably with other tools, it suffers from some key flaws, and a lack of platform portability. As always, your mileage may vary.

If you are a pro web dev, I would advise getting some familiarity with this toolkit – it’s going to be around for a while.

HAHAHAHA

A Japanese company and an American company decided to have a canoe race on the Missouri River. Both teams practiced long and hard to reach their peak performance before the race.

On the big day the Japanese won by a mile. Afterward, the American Team became very discouraged and morally depressed. The American management decided the reason for the crushing defeat had to be found.

A Management Team made up of senior management was formed to investigate and recommend appropriate action. Their conclusion was the Japanese had 8 people rowing and 1 person steering, while the American team had 8 people steering and one person rowing. So American management hired a consulting company and paid them an incredible amount of money. They advised that too many people were steering the boat, while not enough people were rowing.

To prevent losing to the Japanese again next year, the rowing team’s management structure was totally reorganized to 4 steering supervisors, 3 area steering superintendents and 1 assistant superintendent steering manager. They also implemented a new performance system that would give the 1 person rowing the boat greater incentive to work harder.

It was called the Rowing Team Quality First Program, with meetings, dinners and free pens for the rower. Even new paddles and medical benefit incentives were promised for a winner. We must give the rower the empowerment and enrichments through this quality program. The next year the Japanese won by two miles.

Humiliated, the American management laid off the rower for poor performance, halted development of a new canoe, sold the paddles, and canceled all capital investments for new equipment.

The money saved was distributed to the senior executives as bonuses.

home

NY this weekend, be back monday.

Tibs is already there. Creeper and Moist, a rager is deserved, and necessary.

C has no string type


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

const char *s1 = "ZBCDEF";
const char *s2 = "ABCDEFG";

/* strlen using compact pointer notation
*/
size_t MyStrlen(const char *s1)
{
    const char *ptr = 0;                        
    
    while(*s1)                                    
    {
        *s1++;                                    
        ++ptr;                                    
    }        
                
    return( (size_t)ptr );                     
}

/* String comparison using compact pointer notation
*/
int MyStrcmp(const char *s1, const char *s2)
{    
    while(*s1)                                     
    {
        if (*s1 == *s2)                         
        {
            *s2++;        
            *s1++;
                                                
            if (*s2 == 0 && *s1 == 0)         
                return(0);
            else if (*s2 == 0 && !*s1 == 0)     
                return(1);    
            else if (!*s2 == 0 && *s1 == 0)     
                return(-1);            
        }
        else if(*s1 > *s2)                        
        {
            return(1);
        }
        else if(*s2 > *s1)                        
        {
            return(-1);
        }        
    }
return(0);
}

char *GetSubString(const char source[], int start, int count, char result[])
{
    
    if ((unsigned int)start > strlen(source))         
    {                             
        *result = 0;                                
    }
    else
    {    
    
        if ( (unsigned int)start + count > strlen(source)) count = strlen(source) - start;

        while(start > 0)                        
        {
            source++;
            start--;                                
        }

        *(result + count) = 0;                        
    
        while ( count > 0 || *(source + count) != 0 )         
        {
             count--;             
            *(result + count) = *(source + count);    
        }
    }
    return(result);
}

#define RESULT_MAX 19

int main(void)
{
    char result[19];
    const char source[] = "JIBSON GLOMGOLDS";
        
    printf("nMyStrlen: %inn",(int)MyStrlen(s1));
    printf("MyStrcmp: %inn", MyStrcmp(s1,s2));    
    printf("GetSubString %snn", GetSubString(source,1,5,result));

    return(0);
}


Fun with pointers, see if you can figure it out. By the time I finished this, I finally understood pointers.

C is a great language, try it today.