.NET User Groups are Good

Before yesterday, I didn’t know what I was missing. I’d always gained my knowledge about .NET (and any other technology for that matter) from conferences, classes, reading, work projects, or trying things out on my own. But the ASP.NET custom web controls talk I heard yesterday was a real eye-opener. The speaker, Miguel Castro, made great use of the code snippet feature of VS.NET 2005 to speed up the development he did during his talk. Stepping through actual code in the IDE and not just reading from the few slides he did have made it a very engaging presentation. The only thing that might have made it better was if an electronic version of his presentation was made available after the talk. Until that happens, I’ll record the few notes I captured here.

Personal Notes from Presentation

  • WebControls are ultimately “code generators”
  • They are server-based components; classes that are OOP-aware
  • The terms WebControl and ServerControl are interchangeable
  • WebControls are code-only, UserControls are not.

Advantages of WebControls

  • Isolation of visual components
  • Fully object-oriented
  • Browser independent
  • Promote declarative programming
  • Handle their own state
  • Reusability

Rendered WebControls

  • fastest
  • direct output to HTML
  • least reusable
  • very manual

Composite WebControls

  • code is easy to follow
  • handle complexity well
  • most commonly used

* Inherited controls inherit from rendered and/or composite controls

* Rendered controls usually have direct HTML counterparts.

* HTML controls are a visual designer representation of actual HTML.

When to Use WebControls

  • Use inherited controls when merely extending existing functionality will solve a problem.
  • Use rendered controls for simple widgets.
  • Use composite controls in all other instances.

* The ToolboxData attribute and inheritance make a class a WebControl.
* Override the Render method to generate HTML on-the-fly (rendered controls).
* Advice: use your objects before you develop them (a nod to test-driven development).

* Override CreateChildControls (composite controls).

* ViewState identifies controls with ids, so set them first.

* Tables cannot appear next to each other because they are block elements. Block elements cannot appear inside inline elements. Inline elements can appear next to each other.

* The default master tag for a WebControl is . You should override the TagKey property in .NET 2.0 to change this. In .NET 1.1, you would extend the constructor to do this.

* Implement INamingContainer to make sure control names are unique (.NET 1.1).

Properties

  • Use ViewState instead of memeber variables when creating properties for WebControls.
  • Category, Description, & DefaultValue are basic design-time attributes of every WebControl property.
  • Property-mapping needed if a user can change the value of a property.
  • Use “this.ChildControlsCreated = false” in your “setters” for visual properties so control changes are reflected right away, without having to close and re-open the page.
  • Add event handlers for composite controls using your control constructor. Also declare a public event handler delegate.
  • Events are not inheritable
  • Make button controls overridable with protected virtual void methods.
  • Object properties can be made read-only because their internal properties have their own getters and setters
  • Save WebControl state by using an object array. Reserve the zeroth array element for the base.SaveViewState call.
  • Style isn’t serializable, so it’s handled slightly differently.
  • Use ControlState to keep your control functioning even with ViewState turned off.

Recommended Reading
Essential ASP.NET With Examples in C#
Essential ASP.NET with Examples in Visual Basic .NET
Building ASP.NET Server Controls
www.dotnetdude.com
* Just reading good source code is great education

Bosses ‘are deluded’ over success of deals

An interesting title for this story I read in the Times this morning. The acquisition of my current employer (Aspen Systems) by Lockheed-Martin falls right in the area the story discusses (acquisitions of $100 million or more). The buyout is scheduled to close shortly, so I expect to find out soon enough what Lockheed’s plans are for us.

The idea of M & A activity not always creating additional value has been around for awhile. I remember reading stories like this in magazines like The Economist five or six years ago in the middle of the Internet bubble. I’ve only been working full-time for nine years or so, but I’m sure questioning the value of mergers stretches back far before my time.

Since news of the buyout came to us, I’ve been wondering what Lockheed sees in Aspen that they want. Our annual revenue is a tiny fraction of Lockheed’s. As far as I can tell, the thing about Aspen that Lockheed most wanted was the subject-matter expertise. A lot of the civilian agencies we do work for have essentially outsourced certain government offices to Aspen so we can act on their behalf. So while we aren’t an outsourcing power like IBM or EDS, we do occupy a similar niche.

I think Aspen gets plenty out of being bought Lockheed. The first thing is deep pockets. Even more important than the deep pockets is superior processes. We just achieved CMMI level 2 last month, while parts of Lockheed have been at levels 3 through 5 for years. Only time will tell if we help push the LMT stock symbol up.

What Corporations Know About Us

This morning, when I was listening to the umpteenth radio story about the Justice Department subpoena of Google, it occurred to me that Google might know less about us than some other companies.

I’ll use myself as an example. I use Google for searching and Gmail for e-mail. So they know what terms I’ve searched for and when, along with who I’ve sent e-mail to (and received e-mail from). They could certainly know the contents of every e-mail if they wished. The biggest potential risk to me of someone knowing what I’ve e-mailed or searched for is embarassment.

Compare that to what credit bureaus can know about me. TransUnion, Experian, and Equifax know at least the following:

  • current and past addresses where I’ve lived
  • current and past employers
  • when credit accounts were opened and closed
  • what things I’ve bought with credit, as well as when and where I bought them
  • all the loans I’ve taken out, and how quickly (or slowly) I paid them off.
  • who has requested my credit report

According to this web page, there’s a long list of companies and people who can look at my credit report. There are a lot of potential risks to me if I have a bad credit report:

  • I could be denied credit or other loans
  • I could lose out on potential job opportunities (company background check)
  • I could be denied housing (landloard background check)
  • I could end up paying high insurance premiums, or be denied coverage (insurance company background check)

At least Google lets you look at your recent search history. The law only requires credit bureaus to give you free access to your credit report once a year. After that, you have pay to get access.

Somehow, I’m a lot less worried about how Google will use what they know about me.

Advice from Warren Buffett

Buried deep in this article about the dangerous size of the U.S. trade deficit was this bit of advice to MBAs:

“The one piece of advice I can give you is, do what turns you on,” he said. “Do something that if you had all the money in the world, you’d still be doing it. You’ve got to have a reason to jump out of bed in the morning.”

Unfortunately, my current job doesn’t fit this description. I need to do something about that, I just haven’t settled on what.

32

Today is my 32nd birthday. To me, it doesn’t seem like a particularly special birthday. It isn’t like turning 13, when you’re finally a teenager, or 16 when you can drive, or 18 when you’re officially an adult. I remember being excited about turning 18 because I was finally old enough to vote. I don’t drink, but 21 was still a good birthday. People talk about turning 25 as a milestone, but I feel 24 was a bigger year for me because I bought my townhouse that year.

Looking back over the past year, I see a lot of changes. I finally got my MBA after 3 years of working full-time and school nearly full-time. I made my first career change by leaving a full-time programming role and moving into project management. Looking forward, I see the potential for more change. The Lockheed-Martin buyout could change things completely. I might start a business of my own this year, or get out of project management and into something else, like business development or strategy.

.NET Development Tools

Richard Slade came up with a great list of free tools he thinks .NET developers should be using. I first found out about test-driven development and NUnit a couple of years ago in a previous job. It definitely improved the quality of my code. A consultant at my current job told us about TestDriven.NET. I’m looking forward to checking out the upgrade, since we used version 1.1 a year ago.

Ruby on Rails Progress

I finished Curt Hibbs’ first Rolling with Ruby on Rails tutorial today. After getting phpMyAdmin installed, doing the database parts of the tutorial went a lot more quickly. Before I tackle part two, I need to read this post by Amy Hoy.

After this brief tutorial on building a database-backed website with Ruby on Rails, I like the way it works. While I didn’t find the development process quite as simple as the screencasts portrayed it, I can definitely see using it as a rapid application prototyping tool. Even with the hurdles posed by installing and configuring PHP and phpMyAdmin on top of learning Ruby and Rails, getting from page 1 to a completed application didn’t take much time.

I still want to try out the Ruby plug-in for the Eclipse IDE to see how that compares with with SciTe and the command line.

Trying out Ruby on Rails

I made it one of my resolutions to learn Ruby this year, so I took a bit of time yesterday and today to try and get something working on my work laptop running Windows XP. I’d used the one-click Windows installer for Ruby a week before, so I was able to use RubyGems to install Rails. I put the latest version of MySQL on the laptop as well, since the tutorial I’m following uses it.

Instead of building the cookbook application the tutorial describes, I’m trying to build an app that serves a database-driven RSS feed. My reason is that we’ve done this for a client project with some old ASP code and I wanted to compare architectures and level of effort. So far, I like the way Ruby on Rails works. You can create an empty web app just by typing ‘rails ‘ at a Windows prompt. The application directory structure follows the model-view-controller design pattern, so there’s no wondering about where to put certain types of code if you’re familiar with the concept. Generating stubs for controllers and models is also simple (“ruby scriptgenerate controller ” and “ruby scriptgenerate model ” in the web application folder respectively).

Development Ruby on Rails seems to go fastest if you follow their naming conventions for code, and the table names in MySQL. When the model name is singular form of the database table name in plural form (recipe–>recipes or podcast–>podcasts), using “scaffold :” in your controller definition autogenerates the CRUD operations against that table in the database. Making changes then becomes a simple database change exercise. Once a column is added, moved, or removed from a table, just refreshing the browser shows the changes.

I’ll probably go back through the cookbook example and follow it step-for-step before going back to the podcast example, just so I have something stock that’s working. The other thing I plan to do is to replicate my work on the Mac mini I have at home.

Goals for 2006

Improve My Health

  • Exercise 3 times a week
  • Cook 3 times a week

Maintain My Hobbies

  • Shoot 36 film and/or digital exposures a week.
  • Post 3 shots on the photoblog each week.
  • Start re-learning the piano.
  • Go skiing once more (or snowboarding twice) this winter.

Strengthen My Faith

  • Read the Bible every day
  • Pray every day
  • Help out with a church activity once a month

Improve My Career

  • Work on a business plan once a week.
  • Learn Ruby
  • Attend one technology conference this year.
  • Attend one business conference this year.
  • Write a technical blog post once a week.
  • Contact a different person in my network once a week.