Putting on the Web Developer Hat…

The past week, I put on the classic “Web Developer” hat to do some heads down work, so blogging, writing replies back to blog-comments, and answering newsgroup posts has been a bit more sparse. Some of you are probably wonder why I am even doing web development considering I work on the technologies that are “underneath it all”, but that is another story. Now, I still have some more work to do in this area, so I will probably be MIA for a short while yet.

Before I move on, I want to say that I get about half a dozen public/private comments a day that I really should respond to, and I usually end up making blog posts out of the questions in one way or another within 72 hours, but not always… so if you are wondering when my reply is coming… it is not because I am intentionally ignoring you. I plan to getting around to answering them all. I just have a very long queue. 🙂

Now, the Web Developer role has got me doing things that I normally do not touch or even remotely work on (hey, I work on IIS core, so even writing an ASP page is not exactly the norm). Things like relational model design, programming SQL views, stored procedures, and triggers, and accessing data from the database using ADO and ADO.Net (I am writing both a commandline script and an ASP.Net web application). So, I also took the opportunity to take a personal lap around the various Microsoft web-related technologies to see how they work together and how easy (or hard) it is to figure it out, given someone who does not have a whole lot of clue and fairly new to the whole area.

I have to say that overall, I am satisfied with the accomplishments of the task, but I am far from extremely satisfied with the entire experience. All of the information to do my tasks are probably all there on MSDN and web-accessible, but I just cannot find them fast and easy enough to be of any use.

The Joys of SQL (NOT)

I first started with the design of the relational data model since I figured everything else should drive off of the data and its relationships. I realize that relational database design is a topic all its own, but basic prescriptive guidance SOMEWHERE would be nice. I mean, I have never taken a database course nor designed a relational model, so it took me a lot of time and thinking to get started. Fortunately, I ended up doing the right relations and table design, mostly through intuition/luck, but boy was I uncomfortable about many of those choices while doing it – because I had no idea whether it was right or not. In hindsight, I now see so many pitfalls that should be avoided by everyone, but it is not clear how to best disseminate that information…

Then, I immersed in SQL Enterprise Manager to write the queries, views, stored procedures, and triggers, and boy was that an interesting experience. I have no idea whether that UI is good or not when compared with its competitors, but to me, it seems incredibly dated, awkward, and inefficient.

I hate the fact that in order to save any view, stored procedure, or trigger that it has to be syntactically correct. Most of the time I just need to view the various table and column names while constructing the correct SQL statement, but the Editor is modal and I cannot figure out how to simultaneously be in Design View for one table while writing a stored procedure or trigger in the Editor of another.

For the longest time, I had to cut the non-functional statements into the clipboard, close the Editor and save the functional portions, quickly navigate to the right Design View, memorize a couple words of missing information, navigate back to the Editor of the right stored procedure/trigger, open the Editor, paste back the non-functional statement in the correct location, hopefully still remember what I just memorized, spell it correctly, and then continue on.

The only work-around I eventually found is to use the SQL Query Analyzer to simultaneously open a view onto the same database so that I can have both the design of the database and the modal Editor usable at the same time.

I have no idea whether this represents the right way or the “state of the art”, but if it is, I think it is insane. I am expecting non-modal Editors, simultaneous access to Editors and database Design, Intellisense to help me fill in the missing names, syntax coloring with a MONO-SPACED FONT by default (I have no idea how to read much less write code if it is not mono-spaced – how do you consistently align code statements for ease of readability/debugging?), etc.

And while I am talking about fonts… it is incredibly goofy that I have to repeatedly set a mono-spaced font as default in the various Editors. It is like the stored procedure Editor is disconnected from the view Editor and they are both disconnected from the rules Editor and the design table trigger Editor. And none of them obey the “Tools\Font…” menu choice. Hello?!? Is SQL actually one product or not, and do people actually use this? At least the editors remember their custom dimensions, but unfortunately they do not remember where they were located… which may not matter right now since the entire UI involves modal Editors, but still…

Much ADO about Nuttin’

I swear, without looking at sample script code from someone else which I knew worked, I could not have figured out how to use ADO from Windows Scripting Host. MSDN is great at telling me the properties and methods of the Connection object, the Command object, the Parameter object, etc, but it tells me absolutely nothing about how to effectively use ADO, what objects need to be Closed() and when, what objects need to be null-referenced, and what a successful sequence of steps look like to accomplish something like calling a stored procedure or making a SQL query. Yes, I found the Programmers Guide, Getting Started, ADO Fundamentals, Appendix, etc, but they seemed to presume that I knew the terminology, how they translated to the object model, and what objects belonged in conjunction, in what sequence, and with what effect. Now, I eventually figured out how the objects work with each other and in what sequence, but the experience could be better.

Unfortunately, KB articles on ADO gave me very little in terms of knowledge but lots of grief and frustration because there are SO MANY OF THEM. Many KB articles are just slightly different from one another, and many are basically duplicates of each other and probably 95% shared content. Then, there is the occassional KB which advocates doing something completely different for the exact same task of opening a database to call a stored procedure. And I still have no idea which one is better nor why.

I tried a couple of them, and I found in one case that a single variable assignment of the .Execute() method rendered the stored procedure’s @RETURN_VALUE inaccessible. I still have no idea why that was the case, other than that I did not need the assignment and upon removing it, the sample code started working. Hmm…

ASP.Net 2.0 (aka Whidbey)

After I had all the fun wrangling with SQL and its interesting development environment and wandering through a simultaneous deluge of noise and deafening silence that is ADO, I arrived at ASP.Net 2.0.

Frankly, I had high expectations here because I had both seen and heard the hype about how you can drag and drop your way to create awesome, dynamic, and complex data-bound and data-driven web applications without typing in a single line of code and taking maybe a lunch hour to do it all. Sounds great! Sign me up!

I work closely with the ASP.Net team from a IIS core perspective, so I knew where to get the binaries and how to unattend install it all, opened up Visual Web Developer, and got ready to be amazed. And…

I was absolutely amazed.

To start with, the term “data-binding” had absolutely no meaning in my life until that moment. I had never used a data-binding control, never bothered with wiring an application to use SQL as a data repository, and certainly never even created an ASP.Net page before. And now, all of a sudden, it all came together and data-binding started making sense to me. Sure, it made me learn about SQL Views and how I should put as much logic/queries into SQL itself in the form of Views, Stored Procedures, and Triggers and leave ASP.Net to handle the client-side UI experience, but it was fun doing so. No nagging editors and dearth of information – just scrolling through the properties pane of the small number of objects, clicking either the “?” button or F1 help to get some quick info, and then just darn playing around in the UI to figure it all out.

In particular, the “Create a Connection” Wizard solidified in my mind how one should consume data in a data-binding relationship. Using the Wizard made more sense than my hours reading SQL syntax or building the relational data model. Your input data is either in a table or explicit query, or it is a view or stored procedure. You choose the table columns to data-bind, add some WHERE constraint clauses, and the binding gets done. If you want to get fancy you plug the data controls into each other so that depending on the selected ID the other control refreshes in response; I thought that was cool.

Hey, some of you experts probably think nothing of this since it is old hat, but give me a moment to reflect and go gah-gah… 🙂

Ok, where was I. Oh, yes, and the other Wizard that really blew my mind was the Query Builder inside the Connection Wizard. At first, I had no idea why it was so compact and had a scrollable surface area, a grid view, a text box containing a starter SQL query, and a result pane with an “Execute” button. It wasn’t until I typed a SQL query into the text box, clicked Execute, and saw how the rest of the window reacted that I realized how nifty of a tool it was.

Hey, this tool taught me more about INNER JOIN intuitively than my hours of reading SQL documentation and samples about the various types of JOIN. See, I was not kidding when I said that I knew nothing about relational databases. I definitely need to find the PM/Dev/Test of this Wizard somewhere down the hall and thank them. 😉

Now, my first thought after using the Query Builder in Visual Web Developer was “where is the similar thing in SQL Enterprise Manager / SQL Query Analyzer?”, and I went back to the SQL tools looking through every single menu option, left/right mouse click, context menu, etc. I eventually found it in SQL Enterprise Manager, in the most non-obvious place (to me, anyway) for such an awesome tool – right click on a Table, select “Open Table”, and then “Query”.

Huh? Why there? I mean, I wondered by it hundreds of times before because I would just select the “Get all rows…” option to manipulate the Table’s contents. Now, if I had control of that codebase, I would have put it on ALL right click context menus under a catchy name like “Query Builder” that described what it does – because you need to do some aspect of Query Building to construct Views, Tables, Stored Procedures, Triggers… but I could be mistaken and that it is only tied to a SQL Table’s operation. Go figure.

Ok, some of the Visual Web Developer UI is still goofy (for example, the column editor dialog cannot be resized, and it definitely contains long text that eventually needs resizing), but I consider them minor blemishes for the most part. The wealth of data-bound controls and a clickable UI that allowed me to experiment did more to help me along than any amount of reading on SQL, Stored Procedures, Triggers, Views, Tables, Relational Model, ADO, etc. I only wish I had started here first.


ASP.Net 2.0 definitely moved up a couple of notches in my mind in terms of coolness from this interaction. I still very much believe in native code, but maybe this managed code stuff isn’t that bad…

I guess you live and learn…


Comments (15)

  1. zzz says:

    Just wanted to pop in and say that you now know why I’ve never started doing web stuff in MS tools. ASP.NET 2 I think is just a stepping stone to doing these things in WPF and perhaps LINQ too. So I am not going to bother with ASP.Net 2.0 unless I hear it is essential knowledge when doing data access in WPF too. I don’t know if it is.

  2. David Wang says:

    zzz – concerning ASP.Net 2.0 – I do not see how WPF factors into this – different target audience.

    Personally, I think ASP.Net 2.0 is good enough for me to start doing web stuff. I have worked with all the other major web-development technology classes (compiled code like CGI/ISAPI, script code like ASP and PHP) and they pretty much pale in terms of features, functionality, and speed of development to ASP.Net 2.0.

    And my annoyances are mostly behind me, now that I have resolved them all to be fully productive. Like anything new, I just have to get into the way that product thinks.


  3. Peter says:

    Welcome to the world of mere mortals, David. I have to tell you it was wonderfully refreshing to read this post and chuckle at you having the same frustrations we all had when starting out in web development.

    While you may have poured over the help file to try to find things (BTW, connectionstrings.com is a pretty handy website) I must also point out that one vast improvement in VS 2005 is the help system. The sheer volume of information available in the MSDN library makes it difficult at best to find what you’re looking for, but the reorganization of the help (and the inclusion of online sources) is a huge boon in this new version.

    Now, if you could help me with my ISAPI filter I could give you some web development pointers…

  4. Jack says:

    I’m taking class on ASP.net and ADO.net also confused with with what you detailed.

  5. David Wang says:

    Jack – That sounds like a problem with the class. 😉

    Seriously, everyone learns and understands differently, so do whatever works best for you. For example, people learn in the following ways:

    – watching someone else and mimicking

    – doing it themselves hands-on

    – reading technical information and applying

    – asking the area expert questions

    So, figure out what works best for you and then do that.

    For me, I know that I learn by a combination of reading technical information and then applying in combination with asking an area expert questions, though I can substitute the Q&A with quality hands-on experience.

    In other words, I would never take a class on ASP.Net/ADO.Net because it is not exactly how I learn, but it varies by person.


  6. David Wang says:

    Peter – Yeah, well, my Omniscient Skill points have not reached 18 yet. 🙂

    I’m sorry, but I have no idea what ISAPI Filter you are referring to. I get loads of blog requests for ISAPI Filters to do X (In fact, over half of my outstanding questions queue is about filters in one way or another…), and I also have many other code samples planned. I searched through my backlog and I do not see one from Peter.


  7. Peter says:

    I’m sorry, David, I didn’t mean to trigger a search of your backlog, I haven’t actually asked you for help (yet), that was just a rhetorical comment.

    On an only slightly related note, one thing I’ve noticed as I delve into the ISAPI world is a lack of good books. I personally would get a great deal of value out of a list of books you think are useful.

  8. Jack says:

    David, the problem is the book. i’ve never find a good programing book. it’s either too beginner or too deep.

    we’re using this book. http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764557076.html

    we use visual studio.net 2003 while the example on the book use WebMatrix.

    i find most technical book on windows, linux, office, IIS…etc. with less nonesense. (i guess you’re learning how to use tools and not creating them) while programing book are either too difcult or too easy to understand.

    what do you guy at Microsoft read? i like O’reily myself. which publisher do you Microsoft guy purchase from?

  9. Jeff Parker says:

    Hey David,

    Good post and yes funny to see the frustrations you have are the same we all have. Ohh the good old days of classic asp and ado connections. You are correct there was not a lot of documentation on ways to do things. That why I think there was a huge outpouring of good reference sites that have since went .net http://www.asp101.com http://www.4guysfromrolla.com but still have a ton of classic asp articles and help. Far superior to the Microsoft documentation.

    Doing asp.net and ado.net is a much different thing all together. Now you throw in caching, connection pooling, xml, and databinding etc. XML wasn’t even an option in classic asp way to rough to work with then for normal use.

    For books in the previous post I recomend ado.net core reference ISBN 0-7356-1423-7 and then Any book by Dino Esposito on asp.net is going to be great

  10. David Wang says:

    Peter – Unfortunately, I am a pretty bad person to ask about books and in particular about ISAPI. My learning style is to read the technical details and then find and Q&A the area expert to flesh out my understanding, and then I get going.

    So, I just do not read books unless they are like detailed annotated specifications. 😉

    I learned ISAPI by asking the developer of ISAPI many, many questions. So, I have no problems posting back out all that Q&A as people have questions. Though it would take some more effort for me to proactively put together an ISAPI "Primer" based on topics and areas of understanding.

    I went and looked at ISAPI books on Amazon and B&N, and I thought they were all pretty weak. The books that got good ratings were less about how ISAPI functions and more about how to integrate basic programming concepts like async completion, thread pooling, synchronization, HTTP request/response semantics, etc with ISAPI.

    To which I say ‘duh’ because if you understand the core concepts and understand how HTTP works and how ISAPI exposes it, the next logical leap should be that you can re-apply it ISAPI and any API/Programm Language you understand. At least, that is what ‘learning’ means to me. 🙂


  11. David Wang says:

    Jeff – Documentation is one thing. HOWTO Knowledge is another. Microsoft is mostly producing the former because that is what design specifications allow. Someone has to come around and read it, understand it, and synthesize the latter based on experience.

    So, I am glad that you find good reference sites because that tells me the technology gets used, understood, and propagated, and that’s what they are for. Similarly, that is also what I am trying to accomplish with this blog.

    The Visual Studio, .Net Framework, and ASP.Net folks have spent a lot of time with Whidbey focusing on Documuentation as well as HOWTOs, so I look forward to those results.

    Believe me, the number of HOWTO is far more than can be documented by any group of folks, so we have to make our tradeoffs. We cannot possible do it all; where would be the ecosystem otherwise?

    That is not to say I like the process of how Microsoft currently documents and publishes things at all. As far as I am concerned, that whole process is a disaster and gives all of us a PR black-eye because it just does not represent those of us that care.

    Here is the basic idea – I want all product documentation to be like a Wiki, and the community in conjunction with Microsoft makes sure that everyone gets what they need and is happy.


  12. David Wang says:

    Jack – ditto to what I responded to Peter. Unless you learn with a style like mine, you probably do not want to read what I read. 😉

    I look for deep technical content that explains WHY and HOW something works. I am content to figure out the HOWTO myself.

    Many people do not care about the WHY and jump straight to the HOWTO do something because they are paid to do so.

    Still others just need someone to mimic and hands-on.

    Depending on the type of learner you are, the best possible book recommendation can really vary.


  13. >Is SQL actually one product or not, and do people actually use this?

    Well, I don’t know anybody who does any significant amount of database development who uses Enterprise Manager to any extent. It’s really far better suited as an on-the-fly DBA tool. The vast majority of dev work is done in Query Analyzer….This is the tool that I *always* have open.

    Thankfully though, these are both going away for SQL Server 2005 in favor of the all new and *much* nicer SQL Management Studio. It’s the integrated environment that you were looking for, and it’s been modeled after Visual Studio IDE to give it real development horsepower.

  14. Laxmikanth says:

    I think you just spelled out the biggest usability improvement for SQL Server tools (Enterprise Manager) in particular….

    I believe, you should add it to their requirements list..


  15. David.Wang says:

    Laxmikanth – Yeah, I was playing around with SQL Server Management Studio the other day and it is much improved from the development side. I only wish that it showed less "managed code" sluggishness and be snappier. For example, when previewing contents of a Table or View. Oh well… I guess one makes progress one step at a time…