<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Friendly Bit &#187; HTML</title> <atom:link href="http://friendlybit.com/articles/html/feed/" rel="self" type="application/rss+xml" /><link>http://friendlybit.com</link> <description>You have found Friendly Bit, a web development blog. I focus on client side technologies like CSS, HTML and Javascript. You find my articles below and categories to the right.</description> <lastBuildDate>Fri, 05 Feb 2010 23:32:09 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Rendering a web page &#8211; step by step</title><link>http://friendlybit.com/css/rendering-a-web-page-step-by-step/</link> <comments>http://friendlybit.com/css/rendering-a-web-page-step-by-step/#comments</comments> <pubDate>Mon, 11 Jan 2010 00:04:33 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[Browsers]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[JS]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=580</guid> <description><![CDATA[Have you ever thought about what happens when you surf the web? It&#8217;s not as simple as it seems:You type an URL into address bar in your preferred browser.
The browser parses the URL to find the protocol, host, port, and path.
It forms a HTTP request (that was most likely the protocol)
To reach the host, it [...]]]></description> <content:encoded><![CDATA[<p>Have you ever thought about what happens when you surf the web? It&#8217;s not as simple as it seems:</p><ol><li>You <strong>type an URL</strong> into address bar in your preferred browser.</li><li>The browser <strong>parses the URL</strong> to find the protocol, host, port, and path.</li><li>It <strong>forms a HTTP request</strong> (that was most likely the protocol)</li><li>To reach the host, it first needs to <strong>translate </strong>the human readable host<strong> into an IP number</strong>, and it does this by doing a DNS lookup on the host</li><li>Then a <strong>socket needs to be opened</strong> from the user&#8217;s computer to that IP number, on the port specified (most often port 80)</li><li>When a connection is open, the <strong>HTTP request is sent</strong> to the host</li><li>The host <strong>forwards the request</strong> to the server software (most often Apache) configured to listen on the specified port</li><li>The <strong>server inspects the request</strong> (most often only the path), and <strong>launches the server plugin needed</strong> to handle the request (corresponding to the server language you use, PHP, Java, .NET,  Python?)</li><li>The plugin gets access to the full request, and starts to prepare a HTTP response.</li><li>To construct the response a <strong>database </strong>is (most likely) <strong>accessed</strong>. A database search is made, based on parameters in the path (or data) of the request</li><li>Data from the database, together with other information the plugin decides to add, is <strong>combined into a long string</strong> of text (probably HTML).</li><li>The plugin <strong>combines </strong>that data with some meta data (in the form of HTTP headers), and <strong>sends the HTTP response</strong> back to the browser.</li><li>The browser receives the response, and <strong>parses the HTML</strong> (which with 95% probability is broken) in the response</li><li>A <strong>DOM tree is built</strong> out of the broken HTML</li><li><strong>New requests are made</strong> to the server for each new resource that is found in the HTML source (typically images, style sheets, and JavaScript files). Go back to step 3 and repeat for each resource.</li><li><strong>Stylesheets are parsed</strong>, and the rendering information in each gets attached to the matching node in the DOM tree</li><li><strong>Javascript is parsed and executed</strong>, and DOM nodes are moved and style information is updated accordingly</li><li>The browser <strong>renders the page</strong> on the screen according to the DOM tree and the style information for each node</li><li><strong>You</strong><strong> see</strong> the page on the screen</li><li>You get annoyed the whole process was too slow.</li></ol><p>I, too, get annoyed when the above steps take longer than one tenth of a second. But now at least I have some documentation to look at, while waiting the remaining fractions of a second before the page renders.</p><p><a
href="http://www.flickr.com/photos/amboo213/115034446/sizes/s/"><img
class="alignnone" title="Spoiled dog - by amboo213 on Flickr" src="http://farm1.static.flickr.com/45/115034446_8bf43c2273_m.jpg" alt="Spoiled dog" width="240" height="180" /></a></p><p>Spoiled we are, all of us.</p><p><em>(Feel free to add more steps, through the comments&#8230;)</em></p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/css/rendering-a-web-page-step-by-step/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>Tapestry 5, and how not to treat HTML</title><link>http://friendlybit.com/html/tapestry-5-and-how-not-to-treat-html/</link> <comments>http://friendlybit.com/html/tapestry-5-and-how-not-to-treat-html/#comments</comments> <pubDate>Thu, 23 Jul 2009 19:39:10 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=528</guid> <description><![CDATA[I&#8217;ve previously written about how Microsoft Sharepoint mistreats HTML, and makes it look a whole other language. But truth to be told, Sharepoint (and .NET for that matter) isn&#8217;t the only framework that can&#8217;t handle HTML. I&#8217;ve recently worked with a Java framework called Tapestry 5, and it&#8217;s really bad in some respects too (though [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve previously written about how <a
href="http://friendlybit.com/html/default-html-in-sharepoint-2007/">Microsoft Sharepoint</a> mistreats HTML, and makes it look a whole other language. But truth to be told, Sharepoint (and .NET for that matter) isn&#8217;t the only framework that can&#8217;t handle HTML. I&#8217;ve recently worked with a Java framework called <a
href="http://tapestry.apache.org/">Tapestry 5</a>, and it&#8217;s really bad in some respects too (though not quite as bad as Sharepoint). Note that this is a review based on <strong>only</strong> how it handles HTML, not any other of its merits. Let&#8217;s get started.</p><p>Many of Tapestry&#8217;s problems comes from their design decision to parse the HTML you&#8217;re trying to output. Yes, Tapestry parses your HTML, and adds stuff to it dynamically. This is nothing new, anyone that has played with ASP.NET knows how hidden form elements get stuffed in here and there. This is a nightmare for an interface developer, we need exact control over HTML to do our jobs well.</p><p>Tapestry does horrible things to HTML:</p><ul><li><strong>Several extra javascripts and CSS files</strong> are referenced in the head tag. There is no simple way to get rid of these.</li><li><strong>A meta tag</strong> which states that the tapestry did generate this page, is added.</li><li>The two above are added to the head, and if a <strong>head tag doesn&#8217;t exist, it gets added</strong>. Never mind that your current little HTML snippet was just a little part of a page, that was being fetched with AJAX, Tapestry will add a head tag for you.</li><li><strong>More javascript, and a hidden div</strong> with a firebug-like console, is appended to the end of the body element.</li><li><strong>Self-closing tags are expanded</strong> to a start tag and an end tag (&lt;input /&gt; gets transformed to &lt;input&gt;&lt;/input&gt;), which means you can&#8217;t use XHTML together with Tapestry.</li><li><strong>All whitespace is removed</strong> by default, and you have to disable the &#8220;feature&#8221; on a tag-by-tag basis (&#8220;Please don&#8217;t strip whitespace inside this list, IE6 goes crazy then&#8221;). This is a mess for interface developers, who know that whitespace matters for rendering. It was even <a
href="https://issues.apache.org/jira/browse/TAPESTRY-2028">pointed out to Tapestry developers</a> early on, but was ignored.</li><li> There are ways to do loops, if:s, reference variables and generate URL:s, but all of these are based on the HTML parsing. And as a good parser, <strong>it skips all comments</strong>. This means using tapestry template code inside a HTML comment will not work. When do you need that? Conditional comments! So what if you want an URL generated to your IE6 stylesheet? No go. You&#8217;ll have to write a custom component that does that for you.</li><li>Changes the <strong>id of all your forms to &#8220;form&#8221; and adds name=&#8221;form&#8221;</strong> (which is invalid HTML).</li><li>Adds a <strong>hidden &#8220;t:formdata&#8221; field to forms</strong>, much like the dreaded ASP.NET viewstate.</li><li>One of the javascript files added is <a
href="http://www.prototypejs.org/">prototype</a>, a javascript framework which isn&#8217;t compatible with jQuery. So you have to rewrite your javascript code to work in &#8220;No conflicts mode&#8221; if you want it to work with Tapestry.</li></ul><p>No. Tapestry was clearly not built with an interface developer in mind. Why is it so hard for many web framework developers to just talk with people that work with HTML, CSS, and Javascript? Please ask us <strong>before</strong> implementing stuff like the above. We&#8217;ll gladly give you our viewpoint.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/html/tapestry-5-and-how-not-to-treat-html/feed/</wfw:commentRss> <slash:comments>28</slash:comments> </item> <item><title>Interface developers and security</title><link>http://friendlybit.com/css/interface-developers-and-security/</link> <comments>http://friendlybit.com/css/interface-developers-and-security/#comments</comments> <pubDate>Fri, 23 Jan 2009 22:30:44 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[JS]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=398</guid> <description><![CDATA[You live in a new era, when demanding that people register on your site is no longer enough. There&#8217;s far too many other sites out that that you&#8217;re already a member of, you don&#8217;t need another one. You need to trust people.
You also want people to contribute to your sites with content somehow. Text is [...]]]></description> <content:encoded><![CDATA[<p>You live in a <strong>new era</strong>, when demanding that people register on your site is no longer enough. There&#8217;s far too many other sites out that that you&#8217;re already a member of, you don&#8217;t need another one. You need to trust people.</p><p>You also want people to contribute to your sites with content somehow. Text is not enough, you want all kinds of &#8220;rich&#8221; content, and you want people to be able to place them how they want on your page. I mean, we live in a <strong>new era</strong> after all.</p><p>Problem is, this <strong>new era thingie talk</strong> makes people forget the basics. Even though this is the future, and we&#8217;re all bored with &#8220;just&#8221; hypertext, we can&#8217;t allow random people to add HTML to our sites. Why? Ask myspace about the <a
href="http://namb.la/popular/tech.html">Samy worm</a> from 2005, a little piece of clever front-end code that took their servers flying. What did they do wrong? They tried to let untrusted people embed HTML on their profile pages.</p><p>But they even had this clever filter, which cleaned the code first! Well, long story short, using a div with the style attribute set to a background image that points to a javascript url actually execute the javascript in IE6. Didn&#8217;t think of that did you? So what about the fact that both IE6 and IE7 execute vbscripts in urls prefixed with &#8220;vbscript:&#8221;, just like with javascript. Didn&#8217;t know that? Ohhh. Perhaps then you shouldn&#8217;t be trying to let unknown people embed HTML on your site?</p><p>Many of these security issues stem from the fact that ordinary well-educated computer scientists <strong>don&#8217;t know enough about interface development</strong>, HTML, CSS and javascript, and discount them as being something that &#8220;anyone&#8221; could do. &#8220;Even my aunt made this puppy site in like 3 days, how hard can it be?!&#8221;.</p><p>I&#8217;ve always thought that interface development have an undeserved reputation of being easier than &#8220;real programming&#8221;; something that you can let rookies work with, something that no &#8220;real&#8221; programmer would ever want. &#8220;No, I want to work with hard stuff, not that webby stuff&#8221;.</p><p>If you are in a position where people actually think that, perhaps security could be the way to lift interface development to its proper status. So why not read up on <a
href="http://en.wikipedia.org/wiki/Cross-site_scripting">Cross Site Scripting (XSS)</a>, look at <a
href="http://ha.ckers.org/xss.html">examples of vulnerabilities</a>, and pick a couple of examples of <a
href="http://www.xssed.com/">big sites that are vulnerable</a>. While you&#8217;re at it, why not read up on <a
href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">Cross-site request forgery (CSRF)</a> too?</p><p>These are real issues that <strong>someone </strong>needs to take into account when building websites. My guess is that the fancy computer scientists will have a very long way to go before grasping this stuff. &#8220;Why does IE6 parse &#8216;java   script:&#8217; as if there where no space in the middle?&#8221;. You know who&#8217;s not surprised? Every damn interface developer out there.</p><p>So. Go out there, and teach them silly math people how it&#8217;s done, and what your HTML, CSS and javscript-knowledge is worth. Show them that logic isn&#8217;t the way we do things around here, that anything can happen when IE6 boots. And&#8230; whatever you do&#8230; think very hard before letting people embed HTML on your site.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/css/interface-developers-and-security/feed/</wfw:commentRss> <slash:comments>13</slash:comments> </item> <item><title>HTML includes</title><link>http://friendlybit.com/html/html-includes/</link> <comments>http://friendlybit.com/html/html-includes/#comments</comments> <pubDate>Sat, 29 Nov 2008 13:18:49 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[Django]]></category> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=320</guid> <description><![CDATA[One of the first questions beginners ask when starting to learn HTML is how to do includes. They seldom know that includes is what they are asking about, but instead feels bad when having to copy and paste that same menu HTML each time they want a new page. &#8220;Do I have to type the [...]]]></description> <content:encoded><![CDATA[<p>One of the first questions beginners ask when starting to learn HTML is <a
href="http://www.google.com/search?q=include+html">how to do includes</a>. They seldom know that includes is what they are asking about, but instead feels bad when having to copy and paste that same menu HTML each time they want a new page. &#8220;Do I have to type the same thing over and over?&#8221;.</p><p>After asking friends how to solve the problem they get the answer that they now have to learn PHP. Or ASP. Or JSP. Or some other strange language they don&#8217;t need. And install this thing here, and that thing there. What does your server host support? Oh, no, you need to configure stuff better. No, that setting is insecure&#8230; You know the drill, I&#8217;m sure you&#8217;ve walked someone through it sometime.</p><p>So, a way to include a piece of HTML into a random page would clearly benefit beginners learning HTML. But that&#8217;s not all:</p><ul><li><strong>Browsers would be able to cache</strong> components of a page, and therefor load new pages using common components faster.</li><li><strong>Less work learning new template languages</strong> just to find that language X does not have a way to include things.</li><li>Possible to learn componentization by <strong>looking at existing sites</strong> and learn from them. This is an area we need to be better in.</li><li><strong>Easy to make fallbacks</strong> by linking directly to the corresponding HTML snippet.</li></ul><p>So, how would this be implemented? We need a tag that acts as a kind of include, so what about &lt;object&gt;? Just point to the HTML file you want and voilá, it gets included. Since this is HTML it would work exactly the same across all server-side languages.</p><p>Luckily, this is already in the HTML5 spec. At the <a
href="http://www.whatwg.org/specs/web-apps/current-work/#the-object-element">bottom of the object specification</a>. Iinterestingly, I found it <strong>after</strong> writing this article&#8230; Great minds think alike :)</p><blockquote><p>In this example, an HTML page is embedded in another using the <a
href="http://www.whatwg.org/specs/web-apps/current-work/#the-object-element">object</a> element.</p></blockquote><pre><code >&lt;figure&gt;
 &lt;object data="clock.html"&gt;&lt;/object&gt;
 &lt;legend&gt;My HTML Clock&lt;/legend&gt;
&lt;/figure&gt;</code></pre><p>Good! And it even seems to work in current browsers (<a
href="#comment-31225">Thanks Siegfried</a>). I&#8217;ve tested it in Firefox, Opera, and Safari, and it works the same in all of them. Internet Explorer 6, 7, 8 (beta 2) just ignores it altogether.</p><p>The problem is, the current implementation is to handle them just like iframes. And there&#8217;s of course lots of problems with that approach:</p><ul><li>Currently, an object element without a height and width gets rendered as a <strong>300 x 150 pixel block</strong>. There is no reason whatsoever to do this when including HTML. This must change for this to be usable.</li><li>The included HTML needs to be <strong>stylable</strong> with the CSS rules on the page it&#8217;s included from. Currently, this does not work, included HTML is treated as an iframe. Must be changed if this is to be usable.</li><li>Are HTML components full HTML pages? Do they include a doctype and a &lt;head&gt;, and do those get included? I assume only HTML <strong>inside &lt;body&gt; gets included</strong> in the new page. No CSS. No JS linked to in &lt;head&gt;.</li><li>Clicking links inside included HTML should be handled as if the HTML was on the current page. This follows the same concept as if the HTML was included in the server side, and is needed if this is ever going to be used for a menu.</li></ul><p>So, what do you think, is this a good idea? Personally, I&#8217;m hoping more concepts from template languages start to move into HTML.</p><p><strong>Update</strong>: Thanks to the comments (thanks zcorpan) I now have found exactly the above in HTML5. It&#8217;s called <a
href="http://www.w3.org/TR/html5/embedded0.html#seamless">&lt;iframe seamless&gt;</a>. It meets all the points in my list, and I&#8217;m now really looking forward to the first implementation.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/html/html-includes/feed/</wfw:commentRss> <slash:comments>22</slash:comments> </item> <item><title>Templated User Controls in ASP.NET</title><link>http://friendlybit.com/other/templated-user-controls-in-aspnet/</link> <comments>http://friendlybit.com/other/templated-user-controls-in-aspnet/#comments</comments> <pubDate>Mon, 17 Nov 2008 23:28:43 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[HTML]]></category> <category><![CDATA[Other topics]]></category> <category><![CDATA[Tutor]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=323</guid> <description><![CDATA[Good design repeats itself. It works hard to convey a whole, a feeling of consistency. Once you understand a part of such a design, you know your way around all of it. This is often done by repetition, using the same elements, colors, styles, positioning, and so on. This is a good thing.
Good code never [...]]]></description> <content:encoded><![CDATA[<p>Good design repeats itself. It works hard to convey a whole, a feeling of consistency. Once you understand a part of such a design, you know your way around all of it. This is often done by repetition, using the same elements, colors, styles, positioning, and so on. This is a good thing.</p><p>Good code <a
href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself">never repeats itself</a>. The number of techniques to avoid it are numerous, and all new languages compete in trying to remove as much repetition as possible (Especially the dynamic ones).</p><p><strong>Good design repeats itself, good code does not. </strong></p><p>With interface development, you <strong>face the conflict</strong> above over and over again. You get a design that (rightly) reuses the same concepts over and over, and you need to implement them in code that makes you write the same logic only once. This same time both when writing the code and later when fixing bugs in it, and deep inside, all programmers know that it&#8217;s the correct way to do things.</p><p>I&#8217;m currently working in a .NET project (EPiServer CMS 5), and is faced with a design that uses the same kind of boxes all over the site. The boxes only differ by color and content, so things like shadows and rounded corners are clear repetition that I want to do only once. I&#8217;ll do the shadows and corners with CSS, but for that I need a couple of wrapper divs. Divs that I only want to specify once, and then reuse.</p><p>The prequisites are:</p><ol><li>I want a <strong>flexible </strong>solution, so I&#8217;m not tied to a specific HTML structure (number of divs, or even if I use the div tag or not).</li><li><strong>No HTML in properties</strong> that get sent to user-controls</li><li><strong>No HTML in code-behind</strong> (a common way in .NET to split logic (code-behind) and templates (ASP.NET and HTML))</li></ol><p>What I came up with was <a
href="http://msdn.microsoft.com/en-us/library/36574bf6.aspx">templated user controls</a>. They provide a way to write controls that wrap any other controls you may have, and add content around them. And it&#8217;s easy to write and user. This is how the one I wrote is used:</p><pre><code >&lt;MyProject:Box runat="server"&gt;
    &lt;Contents&gt;
        &lt;h2&gt;Random header...&lt;/h2&gt;
        &lt;asp:Repeater runat="server"&gt;...&lt;/asp:Repeater&gt;
        ...
    &lt;/Contents&gt;
&lt;/MyProject:Box&gt;</code></pre><p>It simply wraps anything inside it (in this case a heading tag and a asp repeater), and lets me do whatever I want with them. In my case, I wanted to add some generic HTML around lots of different content, but you could do anything you wanted.</p><p>This is how the above was implemented. First the code-behind:</p><pre><code >using System.Web.UI;

namespace MyProject.templates.units
{
    [ParseChildren(true)]
    public partial class Box : System.Web.UI.UserControl
    {
        private ITemplate contents = null;

        [TemplateContainer(typeof(TemplateControl))]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateInstance(TemplateInstance.Single)]
        public ITemplate Contents
        {
            get
            {
                return contents;
            }
            set
            {
                contents = value;
            }
        }

        void Page_Init()
        {
            if (contents != null)
                contents.InstantiateIn(PlaceHolder1);
        }
    }
}</code></pre><p>&#8230; and then the &#8220;code-front&#8221;:</p><pre><code >&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Box.ascx.cs" Inherits="MyProject.templates.units.Box" %&gt;
&lt;div class="box"&gt;
    &lt;div class="boxwrapper"&gt;
        &lt;asp:Placeholder runat="server" ID="PlaceHolder1" /&gt;
    &lt;/div&gt;
&lt;/div&gt;</code></pre><p>I think this is a <strong>really useful</strong> way to write user controls, especially for those of you that work as interface developers in a .NET world. Asking the people around me I found that quite a few didn&#8217;t know how templated user controls worked, so I hope I will be of use to some of you out there. Happy coding!</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/other/templated-user-controls-in-aspnet/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Don&#8217;t waste time writing HTML and CSS</title><link>http://friendlybit.com/css/dont-waste-time-writing-html-and-css/</link> <comments>http://friendlybit.com/css/dont-waste-time-writing-html-and-css/#comments</comments> <pubDate>Wed, 09 Jul 2008 23:02:50 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=169</guid> <description><![CDATA[When you&#8217;ve worked with front-end development for a while, you start thinking about effectiveness. So without further ado, here&#8217;s my four best ways to be a more effective front-end developer. Feel free to add more ideas as comments!
1. Do you need HTML or CSS for this?
Lots of times when I get stranded on hard problem [...]]]></description> <content:encoded><![CDATA[<p>When you&#8217;ve worked with front-end development for a while, you start thinking about effectiveness. So without further ado, here&#8217;s my four best ways to be a more effective front-end developer. Feel free to add more ideas as comments!</p><h2>1. Do you need HTML or CSS for this?</h2><p>Lots of times when I get stranded on hard problem and sit back, I realize that I really <strong>shouldn&#8217;t be trying to use CSS to solve all layout problems</strong>. Assuming a rounded corner box will have to scale in all directions (up to 8 images!), when it really is fixed width and height (1 image), is an indescribable waste of everyone&#8217;s time. Look closely at the design you&#8217;re trying to implement: does it really have to be as flexible and scalable as you think? Shifting to that mindset saves me hours of work per day.</p><p>One thing that many developers forget is that not all designers care for exact pixels. If something is really hard to develop, walk over to their table and suggest a change. You&#8217;ll soon start to notice that designers are real people too, and that they have as much flexibility as you do. It&#8217;s just as easy to call them up, so don&#8217;t let shyness waste your time.</p><h2>2. Try to set properties once</h2><p>When you know you have to do something (see above), try to <strong>do things once</strong>. This is really tricky in both HTML and CSS, languages that have no variables, and generally makes code reuse a pain. But it is possible.</p><p><strong>With CSS</strong>; set widths of elements once, and trust inner elements to fill their parent. That&#8217;s the default behavior of block level elements, and you can set display: block, or width: 100% on most other elements. Don&#8217;t set heights at all if you can avoid them, and let elements expand to fill their containers. Combine similar CSS selectors to avoid typing things twice, and make new ones for common properties when few properties differ. Use floats and clearing instead of absolute positioning, and you&#8217;ll won&#8217;t have to micromanage positions all the time.</p><p><strong>With HTML</strong>, make sure that you really know the template language. I&#8217;ve fighted with ASP.NET, JSP, JSTL, Smarty, Wordpress Themes, RHTML, and Django&#8217;s Templating Language, and now know enough about all of them to be productive. You should never have to type the same structure out twice, even in HTML. If your template language have loops, if-clauses and includes you really have no excuse to copy large chunks of HTML around. Refactor your HTML and make your own life easy.</p><h2>3. Learn your text editor</h2><p>When code reuse isn&#8217;t possible, <strong>use search/replace</strong> in your favorite text editor.</p><p>Replacing all instances of one HTML tag name with another is about replacing &#8220;element>&#8221; with &#8220;element2>&#8221; (without the opening bracket). That way you replace both opening and ending tags at once. Check to see if your editor supports regular expressions in its search/replace tool. If it does you can save lots of time by learning it. Matching a HTML tag is &#8220;<[^>]+>&#8221;, a starting angel bracket, one or more non-brackets, followed by an ending angel bracket. Naive regexps can make you match the starting bracket of one tag and the end of another, which makes for a mess.</p><p>There&#8217;s lots of little tricks like that, if you learn them you save massive amounts of time.</p><h2>4. Make sure your environment supports you</h2><p>There&#8217;s more than the text editor that you have to work with. One essential part of front-end development is trial and error. It sounds silly but no matter what your skill is, sometimes you must resort to trying and testing your way to a solution. With HTML and CSS, this means being able to <strong>quickly make a change, switch window, and see that change in the browser</strong>. If that cycle takes more that 5 seconds, you&#8217;re losing valuable time.</p><p>Don&#8217;t use a virtual machine (even if it&#8217;s only for IE6) that you can&#8217;t quickly Alt-Tab out of. If you&#8217;re stuck using one, you need to have the text editor on that machine too. It&#8217;s worth your time fixing it.</p><p>Don&#8217;t accept build processes that makes you wait more than 5-10 seconds before you see your changes. With trial and error coding you will then waste 50% of your capacity doing nothing. Most often you can bypass this by copying just the HTML and CSS to the right place, without touching other source-code. I&#8217;ve managed to do this in all kinds of crappy environments, and it&#8217;s always worth it.</p><p>So.</p><p>I hope some of the above can help you save some time each day. The little things add up you know. What&#8217;s your best time-saver?</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/css/dont-waste-time-writing-html-and-css/feed/</wfw:commentRss> <slash:comments>37</slash:comments> </item> <item><title>Sharepoint 2007 &#8211; insanely bad HTML</title><link>http://friendlybit.com/html/sharepoint-2007-insanely-bad-html/</link> <comments>http://friendlybit.com/html/sharepoint-2007-insanely-bad-html/#comments</comments> <pubDate>Sat, 07 Jun 2008 00:42:51 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=163</guid> <description><![CDATA[Sharepoint 2007 continues to amaze me with its terrible interface code. This is code you stumble over all over the place, both in places where you can hack your way around them, and in places where you just have to live with them. Some things are very hard to live with, let me show you:
ASP.NET [...]]]></description> <content:encoded><![CDATA[<p>Sharepoint 2007 continues to amaze me with its terrible interface code. This is code you stumble over <strong>all</strong> over the place, both in places where you can hack your way around them, and in places where you just have to live with them. Some things are very hard to live with, let me show you:</p><p>ASP.NET developers made a decision once to include some hidden form fields, called viewstate, on all aspx pages. When deciding how to include those fields they chose an input with the type set to hidden. When the Sharepoint developers wanted to do something similar they decided on another route:</p><pre><code >&lt;input type="text" name="__spDummyText1" style="display:none;" size=1/&gt;
&lt;input type="text" name="__spDummyText2" style="display:none;" size=1/&gt;</code></pre><p>So we have a visible textbox, hidden with CSS, that has a size of 1 character. No wait, we have two textboxes and they both have very descriptive names (NOT). What the heck were they thinking? Why not type=&#8221;hidden&#8221;, and remove size? Or, I know, don&#8217;t add them at all, they are only dummy right? Note that they are empty.</p><p>Another strange interface decision is the one to include a skiplink in the page. Skip links are links that help screen readers (and others) to navigate to important areas quickly. There&#8217;s many different ways to implement them, here&#8217;s the Sharepoint way:</p><pre><code >&lt;A href="javascript:;" onclick="javascript:this.href='#mainContent';" class="ms-skip"&gt;</code></pre><p>The .ms-skip class positions it far off screen to the left, and the javascript&#8230; wait, javascript on a skip link? Why on earth did they not add #mainContent to the href attribute directly? Only they know&#8230;</p><p>Next in this post is a more philosophical piece of HTML. Look at this:</p><pre><code >&lt;span dir="none"&gt;&lt;table...&gt;...&lt;/table&gt;&lt;/span&gt;</code></pre><p>I&#8217;ve heard about setting text direction to rtl (right to left), and ltr (left to right, for some eastern languages), but never to none. Where do text go that has no direction? Inwards? And what about having a table inside a span element?</p><p>ASP.NET also have user controls, a way to abstract out important pieces of code, to make reuse easy. Sharepoint of course uses this convenient tool regularly, and comes with a couple of useful ones:</p><pre><code >&lt;SharePoint:SPRememberScroll runat="server" id="TreeViewRememberScroll"
onscroll="javascript:_spRecordScrollPositions(this);" Style="overflow:
auto;height: 400px;width: 150px; "&gt; ...</code></pre><p>In the <a
href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.sprememberscroll.aspx">documentation for SPRememberScroll</a> you can learn&#8230; absolutely nothing about it. It seems to strangely interact with a TreeView somehow, and even worse, it has a width and height! I guess it&#8217;s good that it&#8217;s separate from the TreeView itself, so we can remove it from there if we want to forget where we&#8217;ve scrolled to. What?</p><p>Sharepoint 2007, note the year there, also both have the classical spacer gif and a new one; the spacer span:</p><pre><code >Spacer gif: &lt;td width="4px"&gt;&lt;IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""&gt;&lt;/td&gt;
Spacer span: &lt;span style="width: 3px; height: 5px;"&gt; &lt;/span&gt;</code></pre><p>Starting with the spacer gif: Luckily they have their width set twice, both on the image and the cell. Note the &#8220;4px&#8221; there, you can&#8217;t use CSS units when you&#8217;re writing HTML, HTML only knows about pixels. You&#8217;re glad you wrote the width twice now, right? The spacer span is a fairly new thing I guess, the strange thing here is that you can&#8217;t set a width and height on inline elements. It just doesn&#8217;t work, sorry.</p><p>If you&#8217;ve built your user controls really bad, you might need a way to let people customize its HTML to make sense. Sharepoint has a couple of different ways to do this, one that they use themselves like this:</p><pre><code >&lt;SharePoint:DelegateControl runat="server" ControlId="PublishingConsole"
PrefixHtml="&amp;lt;tr&amp;gt;&amp;lt;td colspan=&amp;quot;4&amp;quot; id=&amp;quot;mpdmconsole&amp;quot; class=&amp;quot;ms-consolemptablerow&amp;quot;&amp;gt;"
SuffixHtml="&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;"&gt;</code></pre><p>If you manage to read that, you can see that they are injecting a table row somewhere inside their control (which of course generates a table). Is it just me that feels the urge to add an ending table tag to SuffixHtml just to see what happens?</p><p>Another truly interesting interface construct is the datepicker. It&#8217;s one of these ordinary little calendar icons that opens in a little box and lets you pick a date. How did the Sharepoint guys (or girls) implement that?</p><pre><code >...&lt;A href="#" onclick='clickDatePicker(&lt;long id here&gt;, &lt;long url here&gt;, ""); return false;' &gt;
&lt;IMG src="/_layouts/images/calendar.gif" border="0" alt="Select a date from the calendar."&gt;
&lt;/IMG&gt;&lt;/A&gt;&lt;/td&gt;
&lt;IFRAME SRC="/_layouts/images/blank.gif" FRAMEBORDER=0 SCROLLING=no
style="DISPLAY:none;POSITION:absolute; width:200px; Z-INDEX:101;"
title="Select a date from the calendar."&gt;&lt;/IFRAME&gt;&lt;td&gt;...</code></pre><p>Ok, lots of code to analyse here, and I&#8217;ve still only cut out the middle of a couple of nested tables. A link with an onclick that opens the datepicker is fairly standard, all parameters needed are encoded into a long url sent to that method. There&#8217;s an image to click, with a strange img ending tag, but that could have been a mistake. The strange thing here is the iframe that points to a blank image. It&#8217;s inserted into a table right <strong>between</strong> two cells (yes, you read that right). That&#8217;s just insane. If you for some sensational reason have to use an iframe to display some HTML, output it javascript instead of just setting the src with js. Seriously people. Nice accessibility feature though, to have the alt text both on the image and on the iframe. Twice as accessible!</p><p>Another not-so-fine interface implementation is the following: They want to show a heading and a list of links. Personally, I would have used a heading tag, and an ul with links in. Sharepoint does it like this:</p><p><img
src="/files/headingandlist.png" alt="Black heading, list items with yellow dot before"></p><pre><code >&lt;div style="margin-left: 4px;"&gt;
&lt;div class="level-header"&gt;&lt;span id="header" class="headertitle"&gt;Division&lt;/span&gt;&lt;/div&gt;
&lt;div class="level-item-pos level-item level-bullet"&gt;&lt;span id="header"&gt;
    &lt;a href="&lt;url&gt;"&gt;Information Technology&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="level-item-pos level-item level-bullet"&gt;&lt;span id="header"&gt;
    &lt;a href="&lt;url&gt;"&gt;Research &amp;amp; Development&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
...</code></pre><p>They break their own scheme of prefixing all their classes with &#8220;ms-&#8221; (something that severely messed up my header), they repeat ids, they use only divs and spans, and inline styles.</p><p>Do I need to say more? Want to spread the word? <a
href="http://www.reddit.com/info/6mepf/comments/">Vote on reddit</a>.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/html/sharepoint-2007-insanely-bad-html/feed/</wfw:commentRss> <slash:comments>17</slash:comments> </item> <item><title>Use formats instead of microformats</title><link>http://friendlybit.com/html/use-formats-instead-of-microformats/</link> <comments>http://friendlybit.com/html/use-formats-instead-of-microformats/#comments</comments> <pubDate>Sat, 17 May 2008 11:29:26 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=161</guid> <description><![CDATA[The Semantic Web continues to break new ground, and Web 3.0 seems to be a term that people associate with it. In the backwaters of semantics, microformats aims to develop standards to embed semantic information into XHTML. I can&#8217;t help to think that&#8217;s strange.
One of the principles of microformats is to &#8220;design for humans first, [...]]]></description> <content:encoded><![CDATA[<p>The <a
href="http://www.w3.org/2001/sw/">Semantic Web</a> continues to break new ground, and <a
href="http://en.wikipedia.org/wiki/Web_3">Web 3.0</a> seems to be a term that people associate with it. In the backwaters of semantics, microformats aims to develop standards to embed semantic information into XHTML. I can&#8217;t help to think that&#8217;s strange.</p><p>One of the <a
href="http://microformats.org/about/">principles of microformats</a> is to &#8220;design for humans first, machines second&#8221;. Still, almost all formats are about adding span tags and class or rel attributes to existing XHTML. Humans will never see those, or benefit from them, unless there&#8217;s some kind of machine parsing done on top. Microformats were first built by people working with the blog search engine <a
href="http://technorati.com/">technorati</a>, one of the reasons being to make it easier for technorati to aggregate data from those blogs. So machines it is.</p><p>Thing is, if you&#8217;re going to give information to machines, why not use <a
href="http://en.wikipedia.org/wiki/VCard">vCard</a> instead of the equivalent microformat <a
href="http://microformats.org/wiki/hcard">hCard</a>? hCard is just a translation of vCard into XHTML. vCards open in your e-mail program, allowing you to save the contact information there, hCards don&#8217;t open anywhere. vCards are also just as easy (probably easier) to crawl and parse as microformats.</p><p>So what I&#8217;m saying is, <strong>could we please use real formats instead of microformats</strong>?</p><p><strong>Update:</strong> This article was too fuzzy, so let me clarify: This discussion is about embedded formats vs. formats. The &#8220;vs.&#8221; come from the fact that lots of sites that implement microformats choose not to implement the corresponding format, which in some cases lead to people not being able to use the extra information.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/html/use-formats-instead-of-microformats/feed/</wfw:commentRss> <slash:comments>27</slash:comments> </item> <item><title>Web standards with ASP.NET</title><link>http://friendlybit.com/html/web-standards-with-aspnet/</link> <comments>http://friendlybit.com/html/web-standards-with-aspnet/#comments</comments> <pubDate>Sat, 17 May 2008 10:46:33 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=157</guid> <description><![CDATA[Good interface code is a mix of CSS and HTML, and while most frameworks offer full control over the CSS, they rarely offer that for HTML. This article looks at how ASP.NET developers can help their interface developers gain that control. Disclaimer: I&#8217;m no .NET expert, but too few people write about this stuff, so [...]]]></description> <content:encoded><![CDATA[<p>Good interface code is a mix of CSS and HTML, and while most frameworks offer full control over the CSS, they rarely offer that for HTML. This article looks at how ASP.NET developers can help their interface developers gain that control. Disclaimer: I&#8217;m no .NET expert, but too few people write about this stuff, so I&#8217;ll make a try.</p><h2>Controls that keep the HTML customizable</h2><p>Splitting pages into &#8220;controls&#8221; is a common way to build sites in ASP.NET. There&#8217;s lots of different kinds of controls available, and I can&#8217;t list all of them or name their differences. But I know I don&#8217;t want to compile a .cs file every time a change some HTML. That pretty much rules out anything but <strong>user controls</strong> (as far as I know, but any kind of control that fills the above requirements would do). User controls have two sides, one for C# code (code-behind), and one for tags (HTML and calls to other controls).</p><p>There&#8217;s also the issue of built-in stuff. ASP ships with many pre-built controls that help developers push out things quickly, the problem is that almost all of them neglect the HTML (DataList, GridView, &#8230;). They only allow setting a few properties, sometimes a CSS class, and assume that&#8217;s OK. It isn&#8217;t. I need full control over both the CSS and the HTML to be productive. There&#8217;s one tag in particular is built with my kind of mindset, and that&#8217;s the <strong>Repeater</strong>. A repeater is used like a for loop, but outputs no HTML itself. Instead it allows you to specify some code to output before the loop, inside the loop, every other step, and afterwards. That goes a long way, and that&#8217;s often enough. If the predefined templates are insufficient, like if you want the last item to be rendered differently, you&#8217;re out of luck.</p><p>I think I agree with the <a
href="http://forums.asp.net/p/1239961/2263220.aspx">MVC Framework guys</a> in how to solve missing parameters of default controls and bad output: Use C# code inside your templates. Why is this different than the spaghetti code of old ASP? Because you only use layout related logic, nothing else. People tend to think mixing C# and HTML looks messy, but isn&#8217;t it stranger to make two very different things look the same?</p><p>There&#8217;s also tags like asp:hyperlink, asp:label, and so on; tags that essentially does exactly the same as the HTML they&#8217;re hiding. Please don&#8217;t use them, there&#8217;s no abstraction layer needed for HTML.</p><h2>Don&#8217;t repeat yourself &#8211; not even in the interface code</h2><p>Often when developers move from writing C# code to writing interface code they throw their coding skill out the window. You never copy a C# method just to make it output a different number &#8211; you make that number a parameter to the method instead. In the same way, you should never copy a piece of HTML from one place to another &#8211; move that code to a common masterpage or usercontrol instead. I&#8217;ve seen this many times, even from experienced developers. Never copy code, it makes for nightmare maintainance.</p><p>Also, use nested masterpages. So if you have three pages you need to build, and they have some code in common, you break that common code our into a masterpage. If two of the pages have even more in common you break that out into another masterpage, and let that one use the first one you made. Each Aspx page should only contain what makes it different from the other pages! Repeated HTML can also come in the form of small snippets of code, maybe 10 lines. You might not be able to break that out into a masterpage because it shows up all over the place. For those cases, break the snippet out into a usercontrol instead, and call that. Simple, and <abbr
title="Don't Repeat Yourself">DRY</abbr>.</p><h2>Disable viewstate</h2><p>HTTP is by default stateless. That means that each HTTP request to the server knows nothing about all the other requests made. For scalability and performance, that&#8217;s a great thing. By default, ASP.NET makes web development stateful. Every form field you fill out gets saved into a hidden form field, called viewstate, and sent with every request. But I&#8217;m not talking about performance here, I&#8217;m talking about interface development:</p><p>To be able to save state across requests there&#8217;s a hidden form field, and to be able to send that with every request there needs to be a form covering <strong>all</strong> your form fields. I can&#8217;t help to think that handling statefulness in the HTML (the view) is the wrong place to do it. Aside from taking away some of my control over the HTML, it also has accessibility issues. JAWS, a popular screen reader, switch to a <a
href="http://www.webaim.org/forums/viewtopic.php?id=85">different reading mode when inside of forms</a>, and while it&#8217;s possible to get to all content inside a form, it&#8217;s harder.</p><p>So, start by <a
href="http://www.google.com/search?q=disable+viewstate">disabling viewstate</a> by default. If you must have it for a certain control, only enable it for that control.</p><h2>Summary</h2><p>There&#8217;s lots of stuff you can do to make the HTML look better with ASP.NET, and that&#8217;s a good thing. The bad thing is that it isn&#8217;t that way by default. Now get out of here and go build some good HTML :)</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/html/web-standards-with-aspnet/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Why the class name &#8220;wrapper&#8221; is so common</title><link>http://friendlybit.com/html/why-the-class-name-wrapper-is-so-common/</link> <comments>http://friendlybit.com/html/why-the-class-name-wrapper-is-so-common/#comments</comments> <pubDate>Wed, 30 Apr 2008 14:06:27 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/?p=159</guid> <description><![CDATA[We&#8217;ve all heard about how bad it is to use &#8220;left&#8221; and &#8220;yellow&#8221; as class names and ids. If you name an element &#8220;left&#8221;, and then decide to move that element to the right, you have to go through all your pages and change that name. Too much work.
If you instead had called it [...]]]></description> <content:encoded><![CDATA[<p>We&#8217;ve all heard about how bad it is to use &#8220;left&#8221; and &#8220;yellow&#8221; as class names and ids. If you name an element &#8220;left&#8221;, and then decide to move that element to the right, you have to go through all your pages and change that name. Too much work.</p><p>If you instead had called it &#8220;licenseAgreement&#8221;, you would have been better off. Right? Perhaps not. Because we&#8217;re forgetting about <abbr
title="Content Management System">CMS</abbr>:es. Those often have some kind of templates, where you as an interface developer define how the HTML should look. But as a interface developer, you have no idea of what kind of content editors will put into your templates. A couple of clicks later your &#8220;semantic id&#8221; is wrong.</p><p><strong>I think this is one of the reasons semantics hasn&#8217;t gotten a hold of the CMS world</strong>. CMS:es have no idea of what kind of content people will store in them. Their main business goal is to make something generic, that doesn&#8217;t assume semantics.</p><p>This is why &#8220;wrapper&#8221; is such a common class name.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/html/why-the-class-name-wrapper-is-so-common/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>IE8 is back on the standards track</title><link>http://friendlybit.com/html/ie8-is-back-on-the-standards-track/</link> <comments>http://friendlybit.com/html/ie8-is-back-on-the-standards-track/#comments</comments> <pubDate>Tue, 04 Mar 2008 06:55:45 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/html/ie8-is-back-on-the-standards-track/</guid> <description><![CDATA[Yesterday the Internet Explorer Team showed a big change in attitude. Listening to developer feedback about IE8, they changed their mind, and now IE8 will render standards mode pages using the latest and greatest it can offer.
This is not only a sane way to approach standards, but it&#8217;s also a way to say &#8220;We&#8217;re listening [...]]]></description> <content:encoded><![CDATA[<p>Yesterday the Internet Explorer Team showed a big change in attitude. Listening to <a
href="http://friendlybit.com/css/ie8-and-doctype-switching/">developer feedback about IE8</a>, they <a
href="http://blogs.msdn.com/ie/archive/2008/03/03/microsoft-s-interoperability-principles-and-ie8.aspx">changed their mind</a>, and now IE8 will render standards mode pages using the latest and greatest it can offer.</p><p>This is not only a sane way to approach standards, but it&#8217;s also a way to say &#8220;We&#8217;re listening and are open to change based on your feedback&#8221; (Although saying the reason is the new Interoperability standards and not user feedback is rather weak).</p><p>This move is great for both for the web in general and for the Internet Explorer Team. Let there be celebration!</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/html/ie8-is-back-on-the-standards-track/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Default HTML in Sharepoint 2007</title><link>http://friendlybit.com/html/default-html-in-sharepoint-2007/</link> <comments>http://friendlybit.com/html/default-html-in-sharepoint-2007/#comments</comments> <pubDate>Mon, 25 Feb 2008 23:27:33 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/html/default-html-in-sharepoint-2007/</guid> <description><![CDATA[As I&#8217;ve said before, I&#8217;ve been spending time with Sharepoint 2007 recently. The HTML it produces is really bad, and today I thought I show you just how bad.
Sharepoint 2007 has been &#8220;updated&#8221; to support masterpages, a concept from .NET 2.0. Sharepoint&#8217;s implementation of masterpages has several problems, but none of them even come close [...]]]></description> <content:encoded><![CDATA[<p>As I&#8217;ve said before, I&#8217;ve been <a
href="/css/sharepoint-2007-from-an-interface-developers-view/">spending time with Sharepoint 2007</a> recently. The HTML it produces is really bad, and today I thought I show you just how bad.</p><p>Sharepoint 2007 has been &#8220;updated&#8221; to support <a
href="http://msdn2.microsoft.com/en-us/library/wtxbf3hh.aspx">masterpages</a>, a concept from .NET 2.0. Sharepoint&#8217;s implementation of masterpages has several problems, but none of them even come close to the biggest problem of them all: default.master.</p><p>Default.master is the page that ships with Sharepoint and is used everywhere by default. A quick glimpse at it would make any seasoned web developer feel sick, and I quickly replaced it with something homemade. If you keep reading you will see why. Let&#8217;s get going with the first line:</p><pre><code class="incorrect" >&lt;HTML xmlns:o="urn:schemas-microsoft-com:office:office"
dir="ltr" __expr-val-dir="ltr"&gt;</code></pre><p>Things start out really bad, without a doctype on the first line. This mean that all default pages will render in <a
href="http://en.wikipedia.org/wiki/Quirks_mode">quirks mode</a>, making rendering unreliable across browsers. Next they set an XML namespace, which after some googling points to very <a
href="http://msdn2.microsoft.com/en-us/library/ms875215(EXCHG.65).aspx">thorough documentation (pun intended)</a>. So they mean that it&#8217;s an XHTML document? No, because XHTML has lowercase tags, and here they use uppercase. The attribute <code
class="incorrect" >__expr-val-dir</code> just doesn&#8217;t exist.</p><p>A hardcoded link to the 4000 line &#8220;core.css&#8221; (filled with classnames you have to override by hand), and five external hardcoded javascripts then follow. Then 30 lines of inline CSS and javascript. Then comes the next real beauty, the body tag:</p><pre><code class="incorrect" >&lt;BODY scroll="yes" onload="javascript:
   if (typeof(_spBodyOnLoadWrapper) != 'undefined')
   _spBodyOnLoadWrapper();"&gt;</code></pre><p>The funniest thing here is the scroll attribute. Let me paraphrase <a
href="http://www.htmlcodetutorial.com/document/_BODY_SCROLL.html">htmlcodetutorial.com</a> (found through quick googling):</p><blockquote><p>SCROLL, which is only recognized by MSIE, indicates if there be scroll bars on the page. The default value is YES, so the only reason to use SCROLL is to set it to NO. SCROLL serves little purpose except to confuse and annoy readers by removing scroll bars which are there for a good reason.</p></blockquote><p>I couldn&#8217;t have said it better myself. There&#8217;s no reason, whatsoever, to use the scroll attribute. Ever. Especially with &#8220;yes&#8221; set. <em>Pause for deep breaths</em>. Then we have the inline javascript. Did you know that you could put javascript: inside of onload? Despite all odds, it seems to work. _spBodyOnLoadWrapper() is by the way Sharepoint&#8217;s way of letting you add javascript to pages. You first do a <code
class="incorrect">_spBodyOnLoadFunctionNames.push("YourFunctionName");</code>, and then that code will get run. Insane.</p><p>Then we have the typical ASP.NET form, encapsulating the whole page, followed by 18 hidden HTML fields (including the infamous viewstate). Directly afterwards, we have a 60 line mix of inline and external javascript, contained in 7 different code blocks (two that&#8217;s missing the type and language attribute).</p><p>The next discovery can be found three <em>nested tables</em> later:</p><pre><code class="incorrect" >&lt;span id="TurnOnAccessibility" style="display: none"&gt;
   &lt;a onclick="SetIsAccessibilityFeatureEnabled(true);
   UpdateAccessibilityUI();return false;" href="#"
   class="ms-skip"&gt;Turn on more accessible mode&lt;/a&gt;
&lt;/span&gt;
&lt;a onclick="javascript:this.href='#mainContent';" href="javascript:;"&gt;
class="ms-skip" AccessKey="J"&gt;Skip to main content&lt;/a&gt;</code></pre><p>I&#8217;ll wait until you regain consciousness. Hi, welcome back. Yes, they are using <code
class="incorrect">display: none</code> and javascript calls to enable &#8220;accessibility mode&#8221;. I mean seriously, screen readers ignore things with display: none set, and we can certainly not always trust that javascript is enabled. I also love the skiplink, and how it sets its own href attibute to an internal link. Note how this code is (mostly) lowercase.</p><p>And this is where it starts to get ugly. Every Sharepoint page has a Personal menu and a Site menu on it, containing things you want to do with your account or the current site. Fair enough. This is the (rather lengthy) code for the Personal menu:</p><pre><code class="incorrect" >&lt;span style="display:none"&gt;
   &lt;menu type='ServerMenu' id="zz3_ID_PersonalActionMenu"
   largeIconMode="true"&gt;
      &lt;ie:menuitem id="zz4_ID_PersonalInformation"
      type="option" iconSrc="/_layouts/images/menuprofile.gif"
      onMenuClick="javascript:GoToPage([url]);return false;"
      text="My Settings" description="Update your user information, regional settings, and alerts."
      menuGroupId="100"&gt;&lt;/ie:menuitem&gt;
      ... [three more "ie:menuitem"] ...
   &lt;/menu&gt;
&lt;/span&gt;
&lt;span title="Open Menu"&gt;
   &lt;div  id="zz8_Menu_t" class="ms-SPLink ms-SpLinkButtonInActive"
   onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)"
   hoverActive="ms-SPLink ms-SpLinkButtonActive"
   hoverInactive="ms-SPLink ms-SpLinkButtonInActive"
   onclick=" MMU_Open(byid('zz3_ID_PersonalActionMenu'), MMU_GetMenuFromClientId('zz8_Menu'),event,false, null, 0);"
   foa="MMU_GetMenuFromClientId('zz8_Menu')"
   oncontextmenu="this.click(); return false;" nowrap="nowrap"&gt;
      &lt;a id="zz8_Menu" accesskey="L" href="#" onclick="javascript:return false;"
      style="cursor:pointer;white-space:nowrap;"
      ... [five more eventhandlers] ...
      menuTokenValues="MENUCLIENTID=zz8_Menu,TEMPLATECLIENTID=zz3_ID_PersonalActionMenu"
      serverclientid="zz8_Menu"&gt;
         Welcome Emil Stenström&lt;img src="/_layouts/images/blank.gif" border="0" alt="Use SHIFT+ENTER to open the menu (new window)."/&gt;
      &lt;/a&gt;
      &lt;img align="absbottom" src="/_layouts/images/menudark.gif" alt="" /&gt;
   &lt;/div&gt;
&lt;/span&gt;
&lt;script type="text/javascript" language="javascript"&gt;var _spUserId=14;&lt;/script&gt;</code></pre><p>There&#8217;s several things worth a note here (in a bad way). The menu tag Sharepoint uses is in fact a real HTML tag, <a
href="http://www.w3.org/TR/html401/struct/lists.html#h-10.4">deprecated in HTML 4.01</a>. Inside of that we have a tag called ie:menuitem that I really can&#8217;t understand. What on earth is ie:menuitem? Did they intentionally not make it work in other browsers? Everything is wrapped inside a <code
class="incorrect">display: none;</code> As you see, tags are also cluttered with event handlers, both real and made up ones. The contextmenu is blocked twice, and a spacer gif is used to add alternate text to the link. The menu icon is hardcoded into everything.</p><p>It goes on in the same manner, with tables with the &#8220;TOPLEVEL&#8221; attribute (and no value), divs with a WebPartId set, PlaceHolder tags rendered directly out in the HTML (instead of parsed by ASP.NET), to end with 200 lines of mixed inline javascript and css. Everything embedded in several layers of nested tables.</p><h2>In conclusion</h2><p>Default.master contains the worst code I&#8217;ve ever seen, and it&#8217;s really disappointing to see that from a product with &#8220;2007&#8243; in it. Microsoft have failed in every possible way when it comes to the interface code, and I believe the only way out is to rebuild Sharepoint from scratch (not likely to happen). Having to work with Sharepoint is a real pain, and I honestly don&#8217;t recommend it to anyone. Put your curiosity to use into something more interesting, like the <a
href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx">ASP.NET MVC Framework</a> instead. Thanks for listening.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/html/default-html-in-sharepoint-2007/feed/</wfw:commentRss> <slash:comments>18</slash:comments> </item> <item><title>IE8 and Doctype switching</title><link>http://friendlybit.com/css/ie8-and-doctype-switching/</link> <comments>http://friendlybit.com/css/ie8-and-doctype-switching/#comments</comments> <pubDate>Sat, 26 Jan 2008 16:44:50 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[HTML]]></category><guid
isPermaLink="false">http://friendlybit.com/css/ie8-and-doctype-switching/</guid> <description><![CDATA[The topic of this week has been IE8s new rendering mode, and the strange way to trigger it.  As usual, I&#8217;ve decided not to comment right away, and instead first read what others are saying and try to form an opinion.
I believe the best articles that talks about the switch are these:Legacy, by James [...]]]></description> <content:encoded><![CDATA[<p>The topic of this week has been IE8s new rendering mode, and the strange way to trigger it.  As usual, I&#8217;ve decided not to comment right away, and instead first read what others are saying and try to form an opinion.</p><p>I believe the best articles that talks about the switch are these:</p><ol><li><a
href="http://www.b-list.org/weblog/2008/jan/23/legacy/">Legacy</a>, by <span
class="person-name">James Bennet, puts this move in a bigger context. I believe his most important conclusion is that Microsoft are now clearly positioning themselves towards big old corporate intranets, reiterating &#8220;Don&#8217;t break the web&#8221;.<br
/> </span></li><li><a
href="http://www.andybudd.com/archives/2008/01/has_internet_ex/">Has Internet Explorer Just Shot Itself in the Foot?,</a> by Andy Budd, talks about how Microsoft marginalizes their own browser. Most people won&#8217;t know about the switch, and end up in IE7 mode, so there&#8217;s no real need for anyone to upgrade. IE7s rendering engine needs to be with us, forever.</li><li><a
href="http://diveintomark.org/archives/2008/01/23/microsoft-koan">Microsoft koan</a>, by Mark Pilgrim, elegantly points out that strange code (unknown doctypes, including html5) will be rendered in standards mode, and ordinary code (proper doctype) will be rendered in IE7 mode. Seems twisted?</li></ol><h2>The real strangeness</h2><p>What I can&#8217;t understand in all of this is how IE7-specific sites can be such big of a problem. Because that what all of this fuss is really about. That&#8217;s why we need a new switching mode and they need to ship the IE7 rendering engine with IE8.</p><p>So, now there&#8217;s a couple of different sites.</p><ul><li><strong>IE6 specific sites.</strong> My guess is that these are the majority of sites out there. These will break as much in IE8 as they did in IE7. &#8220;Don&#8217;t break the web&#8221; does not apply to these sites.</li><li><strong>IE7 specific sites</strong>. These are much fewer and got updated rather recently (badly, to work only in IE7). The new switch is there for these sites. With the switch these sites won&#8217;t break.</li><li><strong>Sites built to the standards</strong>. These were also updated rather recently, but unlike the above sites they were built to the standards. Fixes for IE6 and IE7 were properly only sent to just those browsers, and will <em>not </em>be sent to IE8 (conditional comments anyone?). If you targeted IE7 with your conditional comment, IE8 will not get that fix, breaking these type of sites. Well, unless IE8 will execute IE7 conditional comments, when that engine does the rendering.</li></ul><p>So let&#8217;s look back at the previous articles, keeping in mind the IE team mantra: &#8220;<em>Don&#8217;t break the web</em>&#8220;, the very reason why this fix exists.</p><p><strong>First article</strong> (1): My guess is that many corporate intranets belong in the first group of sites. They haven&#8217;t been updated in a while, and won&#8217;t be either. This group of sites will be just as unhappy with IE8 as they were with IE7. This can&#8217;t be about those sites. IE team mantra: &#8220;<em>Keep breaking the web just as much as we broke it before</em>&#8220;.</p><p><strong>Second article</strong> (2): This switch will increase the number of sites in the IE7 specific group. This will be at the expense of the standards group. When a developer not knowing about the switch sees that his site works in IE7 and IE8 (which will be the same), he will stop working on it. IE team mantra: &#8220;<em>Freeze the web to IE7</em>&#8220;.</p><p><strong>Third article</strong> (3): Since unknown doctypes will send IE8 into standards mode, there will be even more breakage than before. What? Well, sites with broken doctypes, that previously sent IE6 and IE7 into quirks mode and relied on that, will break. IE Team mantra: &#8220;<em>Break the web</em>&#8220;.</p><p>Additionally, modern developers that don&#8217;t read the IE blog, and don&#8217;t know about the new switch, will keep getting IE7s strange behaviour on their sites. And since the switch also can be made via a HTTP header, even copying the full HTML and CSS of a site might break it when looking at it locally. IE team mantra: &#8220;<em>Make people read our blog, or go insane trying to develop to the standards</em>&#8220;.</p><h2>What it all comes down to</h2><p>This is a terrible idea, both technically and in how it was presented. If the same idea had been presented in a more open manner, &#8220;<em>we&#8217;re thinking about solving this problem like this&#8230; what do you think?</em>&#8220;, people would have been much more willing to help, and had probably came up with a better solution.</p><p>WaSP really acted badly by not first talking to the community, or at least discussing things internally, and instead just presented how IE8 will be built. Also, since this won&#8217;t help developing standards based websites, and instead help IE7 specific sites, I&#8217;m not sure what the WaSP has to do with this issue whatsoever.</p><p>On the constructive side of things, I think the <strong>best way forward for IE8 is to change the switch to be opt-in, letting IE7 specific sites switch to IE7 rendering if they want to</strong>. That&#8217;s makes sure IE7 sites that break are easy to fix, and does not break havoc on the rest of the web. Don&#8217;t set the default to worse rendering than you can produce.</p><p>With the above change, I&#8217;m looking forward to another modern web browser, IE8.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/css/ie8-and-doctype-switching/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Sharepoint 2007 from an interface developer&#8217;s view</title><link>http://friendlybit.com/css/sharepoint-2007-from-an-interface-developers-view/</link> <comments>http://friendlybit.com/css/sharepoint-2007-from-an-interface-developers-view/#comments</comments> <pubDate>Sun, 20 Jan 2008 11:10:42 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[JS]]></category><guid
isPermaLink="false">http://friendlybit.com/css/sharepoint-2007-from-an-interface-developers-view/</guid> <description><![CDATA[Like Cameron Moll (Skinning Sharepoint and Pointedly unskinnable), I&#8217;ve been working with Sharepoint 2007 (aka MOSS) recently, and I hope you don&#8217;t mind me posting a few articles about my work here. I&#8217;ve found far too few blog posts that really go to the depth in explaining how things really work. I&#8217;ll try to do [...]]]></description> <content:encoded><![CDATA[<p>Like Cameron Moll (<a
href="http://cameronmoll.com/archives/2007/05/skinning_ms_sharepoint_with_st/">Skinning Sharepoint</a> and <a
href="http://cameronmoll.com/archives/2007/10/sharepoint_2007_pointedly_unskinnable/">Pointedly unskinnable</a>), I&#8217;ve been working with Sharepoint 2007 (aka MOSS) recently, and I hope you don&#8217;t mind me posting a few articles about my work here. I&#8217;ve found far too few blog posts that really go to the depth in explaining how things really work. I&#8217;ll try to do that here, but I hope you can respect my wish that this does not turn into a helpdesk.</p><h2>&#8220;Customization&#8221;</h2><p>Let&#8217;s start. <strong>Sharepoint 2007 very, very hard to customize</strong>. If your job is to customize the interface in any major way, you have a lot of work ahead of you. You might think you&#8217;re a much better interface developer than me, but you still have a lot of work ahead of you. You need to accept that.</p><p>When you read about Sharepoint 2007 on other sites you will find that people are really ecstatic about it. Just check the comments on how to <a
href="http://planetwilson.blogspot.com/2007/09/sharepoint-2007-colour-color-calendar.html">customize the calendar</a>. Reading carefully you will find that he&#8217;s comparing it with Sharepoint 2003, not with other products, or even a standard ASP.NET site. That&#8217;s a big difference. Sharepoint 2003 was much worse, but that does not mean things are good now. This is a common pattern, people that like Sharepoint compare it to the previous version, not with better ways of doing things.</p><p>As most CMS:es, Sharepoint gets sold to customers that don&#8217;t know programming. They see a product that can handle all the features they want: blogs, wikis, forums, calendars, document libraries, workflows, and so on. All features you could ever want is included, from what is called &#8220;out of the box&#8221;. The problem is that the system is built so that all of those &#8220;out of the box&#8221; features are hard to customize. Things like changing how the wiki renders, is really hard. Often it&#8217;s easier to rebuild that feature from scratch, than customizing what Sharepoint ships.</p><p>This is the main reason, from my point of view, that you should pick another CMS.</p><h2>Specifics</h2><p>I don&#8217;t believe you trust me on my words, so I thought I&#8217;d be more specific now, and talk about the issues that make Sharepoint 2007 hard to work with (customize). Let me stress that these are not all the issues, just the major ones that an interface developer has to tackle.</p><h3>Development</h3><p>From what I&#8217;ve read from larger projects, the recommended development environment for a Sharepoint site is a virtual machine. For us, we needed a 36 Gb image, a size that required me to get a new external hard drive, just to store it. Also, running in a virtual machine means that you only can use about half of your RAM, which means everything gets slow. As if that wasn&#8217;t enough, a new virtual machine means you have to reinstall all your programs, browsers, plugins again. Web development shouldn&#8217;t have to be like that.</p><h3>Accessibility</h3><p>Sharepoint has gotten a lot of bashing for not being accessible, so they&#8217;ve added <a
href="http://blogs.msdn.com/sharepoint/archive/2006/04/24/582506.aspx?harrison">some features</a> to account for that. Some of those are really good individually, but looking at the general mess that is the HTML that Sharepoint spits out, the pretty page above fades in importance. One major problem is that you still need <strong>javascript enabled</strong> for many of the accessibility features. Enabling &#8220;Accessibility mode&#8221;, among other things, makes dropdown menus appear as new windows (popups) instead of dynamically writing HTML to the page. And this is after they &#8220;fixed&#8221; it.</p><h3>Page size</h3><p>A standard Sharepoint site uses lots of default Javascript and CSS in two files called core.js and core.css. All in all they add up to over 250 kb. Yes, that&#8217;s not a misspelling or extra zero, a default page in sharepoint takes at least 250 kb. This is not counting the HTML, a huge, table-ridden, inline-javascripted, mess of things.</p><p>If you go through lots of trouble, you can strip those files out, but that means you can&#8217;t use any default components. Since much of Sharepoint depend on those, you don&#8217;t really want to go that way. It&#8217;s a mess, and Microsoft themselves recommend you try to <a
href="http://msdn2.microsoft.com/en-us/library/bb727371.aspx#MOSS2007OptPerfWCM_PagePayloadSmallisGood">remove some of it</a> to boost performance. Preferably by using AJAX to load the js file later. Seriously.</p><h3>Javascript and Browser dependencies</h3><p>Except from core.js, the javascript is spread out all over the place. As usual in many CMS:es, javascript is not treated as a real programming language, so there&#8217;s no structuring whatsoever. Sometimes it&#8217;s script tags, sometimes inline, sometimes external mini files, and most often automatically generated code. It&#8217;s a real mess, and is a big reason for the HTML size being so large. Many of the scripts do not work in browsers other than IE, which means you really need IE to properly use the admin interface.</p><p>From the <a
href="http://blogs.msdn.com/sharepoint/archive/2006/07/19/improvements-in-web-browser-compatibility.aspx">browser compatability info</a> you can read that there are level 1 and level 2 browsers:</p><blockquote><p>&#8220;Level 2 web browsers support all of our basic functionality so that users can both read and write in our content sites, perform site administration, etc.  Some functionality may not be available, some functionality may be available in a more limited form, and some visual rendering may not be as optimized as our Level 1 browsers.  We also will not support Level 2 web browsers on the Central Administration site.&#8221;</p></blockquote><p>These are the Level 2 browsers: Firefox, Netscape, Safari. Opera isn&#8217;t even in the list. Is this the new, modern way, of handling cross browser compatibility?</p><h3>Changing the CSS</h3><p>I previously said that most CSS is included in a file called core.css. The file in itself if huge, with thousands of class names, and no structuring whatsoever. Heather Solomon has made an attempt to make things workable by <a
href="http://www.heathersolomon.com/content/sp07cssreference.htm">making images of what each class specifies</a>. It&#8217;s not even nearly a complete reference, and helps some, but using <a
href="http://getfirebug.com/">Firebug </a>is a faster way. Another thing the CSS sheet above does, is show how completely unorganized the CSS is. Have a look at it.</p><p>As with core.js you can&#8217;t really remove core.css, since lots of built-in functionality depends on it. So what you need to do is start deciding which of those rules you need to overwrite and which not. Have fun!</p><p>To add to the insult, if you just add your own CSS as an external file and try to link to that on your own pages, core.css is appended as the last stylesheet in the source code. This of course means that all your changes get overwritten, and you need to hack around things by using the &lt;link&gt; tag directly (instead of sharepoint&#8217;s own csslink-control), or add your custom files via the admin interface. Since core.css is just a list of simple class names, you can also use <a
href="http://www.htmldog.com/guides/cssadvanced/specificity/">CSS Specificity</a> to make your rules count, but that isn&#8217;t mentioned in any of the troubleshooting blog posts. None the less, it&#8217;s tedious do work around.</p><h3>Share point and Master pages</h3><p>Most of Sharepoint is upgraded to use .NET 2.0, and its concept of Master pages and aspx pages. For those of you that don&#8217;t develop in .NET the two can be explained as a templating mechanism, where each Master page has general placeholders where you can insert aspx pages. In each aspx page you specify one master page, and all of the placeholders you want to fill with content. It&#8217;s a pretty good system.</p><p>Sharepoint taps into this system by making up two strings &#8220;~masterurl/custom.master&#8221;, and &#8220;~masterurl/default.master&#8221;, that you use instead of specifying your own masterpages. Users then specify masterpages in the admin interface, potentially breaking the entire site. Also, Sharepoint assumes there&#8217;s just one masterpage per site, so if you thought you could use one masterpage for twocolumn layouts, and another for threecolumn layouts, you&#8217;re wrong. The solution here is to break out of the Sharepoint way and hardcode real urls instead of doing things the Sharepoint way.</p><p>There&#8217;s also things you can&#8217;t change. The admin interface has a masterpage called application.master, which controls pretty much everything that has to do with built-in Sharepoint things. You don&#8217;t ever change this file, since it&#8217;s quite easy to seriously break things then. The problem is that this file also specify the look and feel of the admin interface, and if you&#8217;re building a site where people are expected to add stuff, they will spend time in the admin interface. There isn&#8217;t a good way around this, and you probably end up just changing some colors via CSS and let it be.</p><h3>Default .NET controls</h3><p>The default master pages that ship with Sharepoint is horrendous and I&#8217;ll post more details about them in a later post. But even if you roll your own master pages from scratch you still have the standard .NET-problem with controls. Using controls in .NET is a way to package functionality that you can easily add to your pages. A developer just needs to copy a DLL file, and call the control, optionally sending in some parameters. Easy.</p><p>The problem with this approach is that a control consists both of logic and HTML. So if you want some built-in logic that renders, say, the breadcrumb trail, you also get the HTML the author of the control deemed appropriate. In Sharepoint, a breadcrumb trail can be a doubly nested table, with display: none; controls to enable accessibility, and a doubly span nested link. It&#8217;s just a terrible mess, but there&#8217;s no other way to get to the breadcrumb logic, except from building a new control from scratch. Be prepared to work with terrible HTML.</p><h2>In summary</h2><p>If you want to examine the points above by yourself, there&#8217;s a MOSS example site up at <a
href="http://www.wssdemo.com/default.aspx">wssdemo.com</a>.</p><p>This article is a interface developer view at Sharepoint 2007. If you look at the system from other viewpoints, I&#8217;m sure there are good things there. That&#8217;s not my point. What I&#8217;m trying to say is that <strong>Sharepoint 2007, is beyond repair when it comes to interface customization</strong>, and you should do everything in your power to avoid working with it. If I can give one interface developer the arguments to convince a customer to pick another system, this article was worth it. Thanks for reading.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/css/sharepoint-2007-from-an-interface-developers-view/feed/</wfw:commentRss> <slash:comments>29</slash:comments> </item> <item><title>I&#8217;m an interface developer</title><link>http://friendlybit.com/css/im-an-interface-developer/</link> <comments>http://friendlybit.com/css/im-an-interface-developer/#comments</comments> <pubDate>Mon, 20 Aug 2007 22:17:55 +0000</pubDate> <dc:creator>Emil Stenström</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[JS]]></category><guid
isPermaLink="false">http://friendlybit.com/css/im-an-interface-developer/</guid> <description><![CDATA[In his latest post Roger Johansson asks the question Are we designers or developers?. I have a simple answer for that. None of them. Let me explain:
First we have these people calling themselves developers. And boy do they know programming&#8230; and math&#8230; and&#8230; no that&#8217;s all. Many have a masters degree in computer science, a [...]]]></description> <content:encoded><![CDATA[<p>In his latest post Roger Johansson asks the question <a
href="http://www.456bereastreet.com/archive/200708/are_we_designers_or_developers/">Are we designers or developers?</a>. I have a simple answer for that. <strong>None of them</strong>. Let me explain:</p><p>First we have these people calling themselves <strong>developers</strong>. And boy do they know programming&#8230; and math&#8230; and&#8230; no that&#8217;s all. Many have a masters degree in computer science, a degree that pretty much tells you that they once gave five years of their lives to programing, how cool is that!? It&#8217;s not unusual to find people that <a
href="http://xkcd.com/55/">think in those terms</a> too. You can recognize them by their 10 year old, unmatched, clothes and you&#8217;ll rarely talk more than 1 minute with them. Very efficient.</p><p>Then we have the <strong>designers</strong>. Either real females, or people very close to females, that just can&#8217;t stop talking about this abstract thingie-thongie that just like, you know, exploded in a big burst of colors and like&#8230; &#8220;EHEM! Sorry!&#8221;, you hear them say, regaining consciousness and flying back to earth. Their clothes, at least you think they are clothes, often look like they where meant for something else. Perhaps for building steel pumps, or killing animals&#8230; or both. Well, at least these clothes are matched&#8230; or very purposefully not at all matched (not at aaaall like the developers). You can talk with these people for hours, probably even days, and still only touch upon the delicate topic of &#8220;a glass of water&#8221;. Oh, and they &#8220;create&#8221; things too. Very deep.</p><p>So where the heck does the <strong>interface developer</strong> come into all of this? Well, imagine you have a real project at hand. Real people that need some new website to do their work. Real deadlines, money that switches hands. Smiling business people that promises things and shake hands. Seems like something you know of?</p><p>Now, imagine bringing a developer and a designer together in a room, for like a month, working together with this new website. Concentrate hard and try to see the images before your very eyes. Will they accomplish anything?</p><ol><li><strong>Hell no!</strong> In 5 minutes they will have started arguing about who should be the first one to open the door, and in what way. One talking about the most efficient way to turn the handle, and the other one defending herself by talking about cosmic beams from Saturn. After the first day the developer will have sore cheeks, after being constantly bitch slapped while hiding under his desk. The third day the designer will sit shaking in a corner after the electric shock induced by the steel helmet the developer built. None of them will survive the fourth day, let alone the project.</li><li><strong>Very yes!</strong> When you meet them after the month has passed you find two harmonic people that smiles to each other and really seem to have connected. They explain to you that the demonstration will be in two parts, first the designer and then the programmer. The designer shows you an app that really touches you, at least you think so, although you not fully understand it. The programmer shows you the other part of the app, one that instantly shows the number 369. They finish the presentation and look at you. You stand up, walk out, lock yourself into a nearby free conference room, and shout with all the power in your lungs: &#8220;HOW THE F*#CK AM I GOING TO DO MY TAXES WITH THIS SHIT?!#&#8221;. When you come back you find them congratulating each other for making the deadline.</li></ol><p>You see? There&#8217;s something missing there. Some kind of link between the two. Someone that can walk into a room with two screaming people and calmly say: &#8220;Hey, you both kinda run linux (SuSE vs. Mac OS X), and have a &#8220;cold&#8221; desktop background (default plain blue vs. modern interpretation of <a
href="http://en.wikipedia.org/wiki/Image:Vasnetsov_Snegurochka.jpg">Vasnetsov Snegurochka</a>), what a coincidence!?&#8221;. There needs to be someone that can walk into the same room the next day and explain that they are talking about two different kinds of &#8220;abstract methods&#8221;. There needs to be a link.</p><p>But there&#8217;s more: An interface developer is silly enough to learn languages that doesn&#8217;t even have variables. Even though he know that his code will be sent as uncompressed plaintext and will be rendered by broken excuses for programs, he won&#8217;t cry himself to bed every night.</p><p>He will also gladly adapt a design to something it wasn&#8217;t really intended for, and he even will make it look somewhat good. He will skip adding those fabulous shadows, to make the deadline on time, and still think of himself a good person.</p><p>You see, even though &#8220;interface&#8221; reflect the visual graphic things, and &#8220;developer&#8221; relate to hard logic code, <strong>interface developers</strong> are real people, not a combination of two halves. I am one.</p> ]]></content:encoded> <wfw:commentRss>http://friendlybit.com/css/im-an-interface-developer/feed/</wfw:commentRss> <slash:comments>17</slash:comments> </item> </channel> </rss>
<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 4/10 queries in 0.017 seconds using disk

Served from: c8.67.364a.static.theplanet.com @ 2010-03-13 17:50:32 -->