Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
User Journal

Journal Iamthefallen's Journal: Lost in .Net 1

Right now I'm developing a reporting web application to be used primarily by our external users. In the process I'm also refactoring some old code to try to establish a more solid platform for future applications, the whole re-usability thing that's so popular these days.

One of the things I've found in working with .Net in general, and ASP.Net in particular, is that it seems that even seemingly simple things can have you spend hours searching forums and articles and testing any variety of the 1000 "innovative" ways that people get things done.

This morning I wanted to create a fairly simple thing, have a base page that other pages inherit from that can provide common functionality, error handling etc. For instance, I want the ability to show a message at the top of each page indicating he outcome of an operation. So I add a ShowMessage method to my base class.

OK, all is fine and dandy.

But, I also want to use ASP.Net master pages for the visual layout, how to accomplish this along with the base page turned out to be not as simple as it would appear. Looking through forums and articles people have come up with a multitude of "clever" ways to do similar things, and the more clever, the more lines of code. So testing the various methods, finding out that there was "just this one little thing" that the developer hadn't solved "just yet".... Various approaches of overriding render methods, assigning master pages at runtime, creating custom content templates, and all kinds of other crazy things.

Finally I thought, "There's got to be a better way to do this".

Which means, there usually is.

The simple solution was the create an Interface with a Showmessage method.
Have the Masterpage implement this interface.
Have the base page test the type of the master page it belongs to, and if the interface is implemented, call ShowMessage in the master page.

Simple, elegant, and very not-clever.

I don't like clever. Too damn many .Net developer sites are clever, so utterly fascinated by the capabilities of the platform that they forget that the goal of developers is usually to get shit done.

This discussion has been archived. No new comments can be posted.

Lost in .Net

Comments Filter:
  • This is the kind of thing that's kept me away from pursuing learning ASP.Net (as an old ASP'er). I don't want to have to spend days trying to figure out how to fight a framework when all I want to do is something simple/just tweak one thing.

    It's my crusty old perception that the Java and .Net worlds are overrun with frameworks.

An authority is a person who can tell you more about something than you really care to know.

Working...