Welcome to CrankyGoblin.Com Sign in | Join | Help

Public Class GeoffAppleby

Inherits Microsoft.VisualBasic.MVP : Implements IBrainFart
The Evolution of Thought

While writing my Gaptcha control, I wrote a few drafts along the way of how it would work. It's funny the way things progress.

I like to think I have a pretty good knowledge of HTML, DHTML, and the HTTP protocol (which when you've got the three covered pretty much covers the whole web right? - well, most of it...) But while I know all that, that doesn't mean I'm very good at ASP.net.

Normal HTML is fine. Classic ASP I can do without a problem. ASP.net? Well, I've done my best to avoid what I can. I understand the theory, and the work I've done with it has been fine, but there's this indescribable thing in the back of my head whispering 'avoid....avoid...' that is really hard to ignore :)

But anyway, I thought it was interesting the way the work on my Gaptcha control progressed through the drafts.

In the first draft, I added some static html to the CommentForm skin file, to see how it would look.

Second, I kept most of the static html, but added a repeater control to spit out a few images. Then I added some static javascript to  make the pictures clickable.

Third, I converted a lot of the static html segments to placeholder asp.net controls, and I the code behind for the blog skin engine I injected hard coded html dynamically into the placeholders at the appropriate times.

I then realised that since so much of the html was hard coded that I should use proper controls. So a few different chunks were converted to label controls.

It was at this stage that I finally decided that hard coding a selection of 9 pictures with 3 to be clicked was a bad idea, so I then converted the three labels that made up the three descriptions of the images to be clicked into a BulletedList control, so that I could as many (or few) labels as necessary, depending on the site config. It was also at this stage that I replaced the repeater control with the DataList control so that I could specify how many items wide it could repeat.

It was only then that it struck me. My chunk of stuff that was the Gaptcha control really should be a standalone control. So I converted it to a proper control and enabled it to be skinned using it's own CS skin file just like all the other controls that make up a community server blog.

So now the only thing in the CommentForm skin was the <CSB:CommentGaptcha> control, and it's code behind called that control's validate() method when a comment was submitted (in the btnSubmit's onClick event).

The control itself is now pretty good. It has some static parts (now that it is it's own control, there's no need to for the text blocks that don't change to be dynamic.

I just thought it was interesting the way it progressed. Start with what you know, then merge it into the way it should be - which, I suppose is how so many of us do everything :)

Posted: Wednesday, October 18, 2006 12:18 PM by Geoff Appleby

Comments

Bernardo Heynemann said:

As long as you learned something new, it was all worthy! :)

But I tend to do the exact opposite as you can see by my blog posts. Once I want to do a project I write a list of the technologies I´m going to use, the ones I know and the ones I don´t have a clue. Then I study the ones I don´t know and, only then, I begin working on the part of the project that includes those technologies.

I´m not saying, by any means, that this is the way for EVERYBODY, since I don´t believe there´s such a thing. Just thought of sharing since you brought the subject up! :)

BTW great work with gaptcha :)

# October 17, 2006 8:05 PM

Geoff Appleby said:

If it's non-web, that's exactly how I work.

It's just web stuff. I can't help but feel that asp.net is somehow wrong...

I think it's because the first time I ever saw an asp.net site, the viewstate was so huge that I was disgusted :)

Oh, and thanks :)

# October 17, 2006 8:15 PM

Bernardo Heynemann said:

Nah don´t be so harsh on ASP.Net now...

ASP.Net 2.0 has come a long way into helping us build solid web applications. Today we can do a lot of things that were once only available to who worked with windows like reuse, inheritance and a lot of such things.

About the viewstate it´s good if you know how to use it. If you correctly turn on and off viewstate for your controls, than it will decrease a LOT!

And btw MasterPages and Skinning ROCKS!!!

# October 18, 2006 7:39 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

To submit your comment, click on these pictures:
  • Sleepy Geoff
  • Geoff has an idea
  • Angry Geoff
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Can't recognise the people in these pictures? Look here for a quick introduction.
There's a time limit for you to get your comment submitted before this set of pictures expires. If you think it's been longer than 10 minutes, get some new pictures first (you won't lose what you've typed so far).
Get some new pictures 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS