Welcome!

Cognitive Computing Authors: Zakia Bouachraoui, Pat Romanski, Yeshim Deniz, Liz McMillan, Elizabeth White

Blog Feed Post

Fun Times With ASP.NET

First off, there’s the two worlds of doing things with ASP.NET.  Actually, there’s three if you count classic ASP, but who’s looking at that?  The first path that I went down in trying to wrap my head around ASP.NET was the web forms method of development.  The bulk of the content online is targeted at this way of building apps, and it was the methodology switched to around the time ASP became ASP.NET.  The second path is the MVC path, and we will get to that in a bit.

At first, I was happy with the materials that I had come upon for learning ASP.NET.  There appeared to be no shortage of books available, and plenty of results turned up in the live.com search (37.1 million to be exact).  The first book that I got from our library (yes, Microsoft has it’s own library, and it’s awesome) was ASP.NET 3.5 Step By Step.  The ratings on Amazon were good, so it seemed like a reasonable starting point.  For kicks, I also grabbed a couple of others.

Here’s my first problem with the ASP.NET literature that I have seen thus far.  For the most part, they really, really want you to understand how ASP.NET works, internally, before you can do anything.  Unfortunately for the ADHD generation, we want to build things, and we can’t be bothered with details.  Page upon page upon page of HTTP pipelines and other minutia.

I myself learn from examples; preferably code tied to a real application.  Too often in books, when there is sample code, the author provides a dump of the code, as if they are trying to say “look how much code I can write,” when all that does is make me want to close the book.  Reading source code is hard, and certainly reading someone else’s is even harder.  Truth be told, that’s why I embarked on this endeavor…to put out postings which were step by step about how I built something in the hope that some other novice would appreciate that I am going through exactly what they are going through.  I know I am not the best developer out there, and I am going to make a ton of stupid mistakes, but no one wants to feel stupid when they are trying to learn something new, and stupid is all I felt trying to learn the forms method of development for ASP.NET.

ASP.NET has a very cool feature called “code behind” which basically separates the code from the HTML for your pages.  I thought this was cleaner than trying to interleave the C# code into the HTML.  That is until I tried to access code that wasn’t part of the code behind source.  I am sure that if I had kept at it long enough I would have sorted through my issues, but for whatever reason, I could not make it work where I had a function in one .CS file and call it form a code behind file.  If you are trying to do this, things to look out for are the differences between “<%=” and “<%”.  That “=” matters quite a bit.  Another thing to be on the look out for, which they seemingly never cover in the code samples and books, is how and when to use includes and the “using” directives.  Remembering that one thing, more than anything, has caused me pain and suffering that I don’t want to recount.  Again, I know I am not the ace developer, but imagine if you have read this far, you aren’t either.

Further annoyances around getting started were things like trying to find useful tutorials online.  Here’s a great exercise.  Perform the following searches:

Did you do it?  How many clicks did it take you to get to useful information for ASP.net?  You would think that first link to the W3Schools Tutorial would be a good one.  It took me 5 clicks to get to the first bit of writing code.  Four pages of really superfluous stuff.  It actually felt like the whole site was set up for SEO and ads.  Not that there’s anything wrong with that, but contrast that experience with the Ruby on Rails example.  One click from the first returned link, and you are writing code.  Still a doubter?  Python was two clicks from the first returned link.  My point in all of this is it simply shouldn’t be hard to get started with a web app platform.

In all fairness, I eventually removed the word “tutorial” from my search term and landed at the asp.net site.  They have many informative articles, videos, etc, upon which to feast, but it took me a while to reduce my search terms.  Unfortunately, the video content at ASP.net suffers from three issues, in my humble opinion.  First, it’s dated – many of the video lessons for ASP.NET are several years old, and are specific to ASP.NET 2.0, not 3.5.  The ASP.NET 3.5 videos all assume you know what the heck you are doing.  Second, the bulk of the intro lesson videos that you can view display visual basic code.  I was a VB6 nerd, so I can appreciate that, but it bothered me that some of the videos didn’t have C# tutorials with C# on screen.  I get wanting to be language independent, but all of the tutorials should be in the two major Microsoft languages.  I know that sounds like a nit, but it’s important for people trying to get up to speed on your platform.  Don’t alienate them, and don’t make it hard.  Third, and last, is the same fatal flaw as the books; the heavy reliance on the forms and server controls for the programming model.  I get it.  People want to see immediate results, and “yeah” I made a grid of data from a database, but when you have specific ideas about things you want to do, and they don’t fit into this notion of using server side controls, it gets difficult to digest the information.  It simply doesn’t line up with the type of apps that breadth developers are building; it feels more geared toward enterprise developers building quick apps for intranets.

Here’s a great example of my difficulties: I wanted to connect to a database.  I created a simple table in SQL Express (that alone was a fun exercise to discuss another time).  I plowed through a bunch of content, all of it showing how “easy” it was to data bind controls.  All well and good, but what I wanted to do was execute a query and put text on the screen.  Eventually I figured out how to create a Data Set.  Have a gander at this first search result which shows up when searching for “asp.net data set.”  Make heads or tails of that.  Oh, and don’t make the mistake of not knowing the name of the data set as defined in the properties window of Visual Studio.  you kind of need to know that.  I didn’t of course.  Further, I took quite a bit of head banging trying to understand why I needed to declare adapter as follows:

UserWordsDSTableAdapters.UserWordsTableAdapter myAdapter = new UserWordsDSTableAdapters.UserWordsTableAdapter();

YIKES!  Thank goodness for auto-complete and intellisense.  Unfortunately, because C# is strongly typed, and because I couldn’t remember that the Data Set was called UserWordsDS, which then gives me the UserWordsDSTableAdapters, I had a hell of a time getting the adapter object created.  Nothing about using the Data Set was easy to just wrap my brain around.  Perhaps one day I will appreciate that there are Get functions that I have created which have the SQL queries in them, and in order to get the data, I have to create a UserWordsDS.UserWordsDataTable object, and then set that equal to the return value of the myAdapter.GetData() function, but I doubt it.  It just feels like obfuscation for the sake of obfuscation.

Finally having the ability to get data from the database had me hopeful, but this is where I ran into the problem of not understanding why I couldn’t create a new .CS file in the project, and use the very same code that I had used in a code behind file to access data and either return a string or write the Response object.  It was at this point that I threw my hands up.  I actually had three different books on my desk, all in a desperate attempt to figure out how to call C# from the aspx file.  I gave up.  And then I discovered ASP.NET MVC.  We’ll leave that post for tomorrow, but let’s just say I got more done in two hours then I did in a couple of days of “learning” traditional ASP.NET.  Must be my Django and Rails tendencies coming through.

Read the original blog entry...

More Stories By Brandon Watson

Brandon Watson is Director for Windows Phone 7. He specifically focuses on developers and the developer platform. He rejoined Microsoft in 2008 after nearly a decade on Wall Street and running successful start-ups. He has both an engineering degree and an economics degree from the University of Pennsylvania, as well as an MBA from The Wharton School of Business, and blogs at www.manyniches.com.

IoT & Smart Cities Stories
Moroccanoil®, the global leader in oil-infused beauty, is thrilled to announce the NEW Moroccanoil Color Depositing Masks, a collection of dual-benefit hair masks that deposit pure pigments while providing the treatment benefits of a deep conditioning mask. The collection consists of seven curated shades for commitment-free, beautifully-colored hair that looks and feels healthy.
The textured-hair category is inarguably the hottest in the haircare space today. This has been driven by the proliferation of founder brands started by curly and coily consumers and savvy consumers who increasingly want products specifically for their texture type. This trend is underscored by the latest insights from NaturallyCurly's 2018 TextureTrends report, released today. According to the 2018 TextureTrends Report, more than 80 percent of women with curly and coily hair say they purcha...
The textured-hair category is inarguably the hottest in the haircare space today. This has been driven by the proliferation of founder brands started by curly and coily consumers and savvy consumers who increasingly want products specifically for their texture type. This trend is underscored by the latest insights from NaturallyCurly's 2018 TextureTrends report, released today. According to the 2018 TextureTrends Report, more than 80 percent of women with curly and coily hair say they purcha...
We all love the many benefits of natural plant oils, used as a deap treatment before shampooing, at home or at the beach, but is there an all-in-one solution for everyday intensive nutrition and modern styling?I am passionate about the benefits of natural extracts with tried-and-tested results, which I have used to develop my own brand (lemon for its acid ph, wheat germ for its fortifying action…). I wanted a product which combined caring and styling effects, and which could be used after shampo...
The platform combines the strengths of Singtel's extensive, intelligent network capabilities with Microsoft's cloud expertise to create a unique solution that sets new standards for IoT applications," said Mr Diomedes Kastanis, Head of IoT at Singtel. "Our solution provides speed, transparency and flexibility, paving the way for a more pervasive use of IoT to accelerate enterprises' digitalisation efforts. AI-powered intelligent connectivity over Microsoft Azure will be the fastest connected pat...
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Druva is the global leader in Cloud Data Protection and Management, delivering the industry's first data management-as-a-service solution that aggregates data from endpoints, servers and cloud applications and leverages the public cloud to offer a single pane of glass to enable data protection, governance and intelligence-dramatically increasing the availability and visibility of business critical information, while reducing the risk, cost and complexity of managing and protecting it. Druva's...
BMC has unmatched experience in IT management, supporting 92 of the Forbes Global 100, and earning recognition as an ITSM Gartner Magic Quadrant Leader for five years running. Our solutions offer speed, agility, and efficiency to tackle business challenges in the areas of service management, automation, operations, and the mainframe.