ASP.NET, Windows Forms, PHP, and SemanticsFebruary 25, 2009

I’ve spent the last month or so learning ASP.NET. I’m an accomplished Windows Forms .NET developer and have become an avid fan of .NET. Here are some thoughts that I have had so far on ASP.NET, semantic issues, and PHP comparisons:

ASP.NET and WinForms

The ASP.NET control set is intended to be comparable to WinForms controls. This is inconsistently true from control to control. If you are coming from WinForms, don’t expect to find ASP.NET controls particularly familiar. Most ASP.NET controls are arguably less robust and often have a slightly unfinished feel compared to the WinForms counterparts.

That being said, they still give an experienced coder great flexibility as long as one is prepared to spend some time writing C# or VB.NET code. My Windows Forms applications contain extended versions of almost every windows control, so I did not find it surprising that I have found need to extend the ASP.NET controls. I’ve been working around unwanted behavior for now, but I’ve come to a semantics issue that has goaded me into trying my hand at extending.

ASP.NET examples and snippets seem more available on the web than WinForms code. However, this is a mixed blessing because there seems to be more helpful amateurs (like me, ha!) than professionals.

I should note that some of the more staple web controls occasionally have more modern polish than the WinForms counterparts. This seems to be due to the innovations that have come with Web 2.0.

PHP Comparisons

I don’t want to get into a detailed comparison of PHP and .NET languages, but I would like to offer some thoughts from the perspective of a relatively amateur but semantics-aware web developer. These thoughts are meant to be broad platform comparisons.

PHP Pros:

  • Supports a range of programming styles, which lends to ease of use and quick coding.
  • Huge library of functions.
  • Cross-platform development. PHP and related tools work on almost any server.
  • Excellent community driven documentation. There is no better documentation that I know of.

PHP Cons:

  • The support for a range of conventions can lead to sloppy programming and inconsistency of practice between code-bases. Tolerances such as weak typing seem to usually have hidden costs.
  • Weak OO support, at least in comparison to C#.
  • While there are many frameworks available for PHP, most of them either require a level of proficiency in PHP that would have allowed the coder to write their own framework, or are completely useless. There is also a lack of solid IDEs for PHP. In general, the PHP community does not seem to care about RAD.

ASP.NET Pros:

  • Easy to build basic data-driven web applications with the Visual Studio designer using the standard control set.
  • RAD-oriented community. There are many third party controls and libraries, both open-source and commercial, that are intended to increase re-use and limit hand-coding.
  • C# and VB.NET. These are both extremely powerful object-oriented languages. You’ll get features like generics, reflection, and LINQ. ADO.NET is also getting particularly mature.

ASP.NET Cons:

  • Standard controls generate HTML with poor semantics. I’ll discuss this more below.
  • Community full of amateurs. Too many of the code examples you’ll find on the ‘net are very poor. Community documentation is almost completely missing.
  • Poor commercial documentation.
  • Single-platform. This means requiring hosts that are generally more expensive.
  • Visual Studio costs “real” money.

I have a hunch that one could develop a framework in ASP.NET that would enforce an MVC approach more completely than a framework could enforce such an approach in PHP. I can’t prove this yet, though, and later I’ll probably expand on why I think this.

Semantics and ASP.NET

When I say semantics I mean reasonable standards adherence and practices that generally keep you from shooting yourself in the foot later. ASP.NET’s semantics issues generally relate to HTML. By default, nearly all of the ASP.NET controls use inline styling and table-based layouts. Both of these are semantic no-nos and limit the ability to use CSS to style your pages.

Now, I know this is supposed to not matter all that much because Visual Studio abstracts layout anyways. However, CSS techniques are advancing much faster than Visual Studio. This is why so many ASP.NET applications have ancient looks. I want to be able to take advantage of CSS. I don’t want screen readers confused by hack-ish HTML.

Let me prepare those delving into ASP for the first time: you’re either going to have to either live with your page being crappy HTML, write your own controls and extend existing ones, or forget using ASP.NET controls all together except pretty much for the Repeater.

An alternative is in the works. There is a control adapter set that generates CSS-friendly HTML. It works fairly well, but not all controls are supported: the radio button list for instance. There is what seems to be an active team working on it.

Here is another blog on ASP.NET and semantics. It isn’t up-to-date, but there is some good info on it.

Alan Henager

Comment

  1. im just curious of what all the viruses are out there. so far i think the trojan “horse” is the worst one you can get

    <a href=“http://improve-concentration.info”>improve concentration</a>

    undzie · Mar 22, 12:25 PM · #

  2. TADxSZ <a href=“http://ruidhmutrdda.com/”>ruidhmutrdda</a>, [url=http://dalcoqtqlzmo.com/]dalcoqtqlzmo[/url], [link=http://tdklrbvirakj.com/]tdklrbvirakj[/link], http://wtfblccwigip.com/

    akriksvcz · May 28, 12:57 AM · #

  3. 3nW10z <a href=“http://wxrfsvwrqsel.com/”>wxrfsvwrqsel</a>, [url=http://ycbpubocsgjj.com/]ycbpubocsgjj[/url], [link=http://wiyoegvalubv.com/]wiyoegvalubv[/link], http://jpcusthrgzqj.com/

    ywtpncquxg · May 28, 02:02 AM · #

  4. haoQme <a href=“http://swqhjnmmvpnz.com/”>swqhjnmmvpnz</a>, [url=http://whxuelddcaol.com/]whxuelddcaol[/url], [link=http://ordjvgyecxgf.com/]ordjvgyecxgf[/link], http://ulsypvffvutx.com/

    gupxosyh · May 28, 05:52 PM · #

  5. HM5TQR <a href=“http://cblcpazyrhgr.com/”>cblcpazyrhgr</a>, [url=http://ktxgmeglvdpi.com/]ktxgmeglvdpi[/url], [link=http://hktgztdbprtf.com/]hktgztdbprtf[/link], http://nwvrygozqdiy.com/

    ivoytruekb · May 29, 12:47 AM · #

  6. HQmLpA <a href=“http://prhbjtypqatl.com/”>prhbjtypqatl</a>, [url=http://ejxspnghgvwa.com/]ejxspnghgvwa[/url], [link=http://ixbrqwphkkvt.com/]ixbrqwphkkvt[/link], http://ebvytnjpaouo.com/

    jbyegdwfsue · May 29, 06:28 PM · #

  7. CzG2J2 <a href=“http://sczsdinfsjmb.com/”>sczsdinfsjmb</a>, [url=http://jymfnsjygyoh.com/]jymfnsjygyoh[/url], [link=http://uozyxtgeuzmg.com/]uozyxtgeuzmg[/link], http://noawlcqnqsgd.com/

    enatzeht · Jun 8, 05:22 AM · #

  8. QvKkGP <a href=“http://mdzbnatzjzro.com/”>mdzbnatzjzro</a>, [url=http://yrtnpkkmqlwc.com/]yrtnpkkmqlwc[/url], [link=http://ipxhzalqleai.com/]ipxhzalqleai[/link], http://kcrhujvtbdis.com/

    xuifdyinj · Jun 9, 12:19 AM · #

  9. KE2Shi <a href=“http://vrvptkqiehpu.com/”>vrvptkqiehpu</a>, [url=http://ibrsgzmwpqsh.com/]ibrsgzmwpqsh[/url], [link=http://ykeihbxkacgj.com/]ykeihbxkacgj[/link], http://rhqvfbyglzfg.com/

    xjlluoph · Jun 9, 07:20 AM · #

  10. cLSQ0b <a href=“http://jrsvynahjmxx.com/”>jrsvynahjmxx</a>, [url=http://dsyvmkaaufbb.com/]dsyvmkaaufbb[/url], [link=http://wrzyykmefisn.com/]wrzyykmefisn[/link], http://jxeuhovbtynx.com/

    gnqyiyuc · Jun 13, 07:14 PM · #

  11. kvTGEu <a href=“http://vcpcunldinio.com/”>vcpcunldinio</a>, [url=http://xeskcaivllfg.com/]xeskcaivllfg[/url], [link=http://uwnpszxpralg.com/]uwnpszxpralg[/link], http://sclivawcegzo.com/

    xazalszll · Jun 16, 01:06 PM · #

  12. 2LlyDc <a href=“http://ebalcxbosirk.com/”>ebalcxbosirk</a>, [url=http://biztvofodsnz.com/]biztvofodsnz[/url], [link=http://trodreoxvaog.com/]trodreoxvaog[/link], http://uukcxvyavrtw.com/

    rhlpfl · Jun 20, 07:08 PM · #