Take the 2-minute tour ×

This question is a more discussion oriented one that a simple problem specific question. Writing basic HTML is simple but writing fast light standards based, SEO best practices complaint, all browsers compatible HTML pages is hard and very time consuming.

But why it hard ?

In my opinion it hard because of the hundreds of different rules what need to be followed, rules what are hard to remember and even if you remember it hard to merge them together in not contradicting form and the only way to validate you work is by loading it in every browsers you support and validating every scenario.

But it really looks like a problem we had in the past in other areas of programming, previously before inventions of high level languages writing program in assembly is looks a lot like writing HTML files, you was forced to remember hundred of different rules for performance, correctness security and so on and the only way to validate them was by executing the program.

In other fields this problem was solved by compilers of high level languages what make a syntax simpler, make performance optimizations, check program syntactic correction before execution.

Don’t you think we need a different simpler language for writing web pages and compiler what could produce browser specific, standard complaint size optimized HTML from this language ?

Do you think it possible to create such languge and compiler ?

share|improve this question
I think this is a great question and something I've wanted also. –  Aseem Kishore Jul 12 '09 at 19:05
What is optimized HTML? Can you give an example of some non-optimized HTML then the same code optimized? Just a small sample. –  Skip Head Jul 13 '09 at 0:22
The most simple example of not optimized HTML is a table with a single tr and a single td used as a block element by people not aware about div elements , I encounter this alot. You also can have much more complex scenario for example you could parse the page and extract the smallest subset of CSS what is needed to render the page correctly –  MichaelT Jul 13 '09 at 9:56

8 Answers 8

up vote 5 down vote accepted

There is some confusion about, I fear. The fact of the matter is that writing good HTML is easy. Very easy. Writing bad HTML is also very easy, but that's neither here nor there.

What is difficult, I think you'll find, is writing good, cross-browser, beautifully rendered CSS. Very difficult, in fact.

And no amount of abstraction will solve that. Only efforts to improve all browsers will help this; and that is no small feat.

Another issue, and this is a bigger one, is that recently HTML is being abused for things it was never meant for; applications that would benefit greatly from being implemented as "proper" desktop applications are being implemented in HTML and JavaScript because it is "easier" for developers on some level (which, as your post highlights, is a filthy rotten lie).

Compatibility issues cannot be defeated easily; and by implementing things on the wrong "platform" you are setting yourself up to fail. Miserably.

The web is not a platform; it's a tangled weave of danger and despair. And, of course, tubes.

share|improve this answer
The 90s called, they want their mindset back –  micmcg Jul 13 '09 at 2:30
We can't solve browser inconsistences, but it possible to make the procces of fixing your HTML/CSS to compensate for them automatic –  MichaelT Jul 13 '09 at 10:05
Well, yes and no. Unfortunately, browser vendors keep finding new and exciting ways of being inconsistent. –  Williham Totland Jul 13 '09 at 10:39

Personally, I believe that with a decent amount of preparation, there is very little difference in writing 'basic' HTML and standards compliant HTML. Even starting from scratch, I don't think it's any harder.

Similarly, once you've developed a few sites, any rules regarding validation, etc will become second nature

share|improve this answer
Did you know what exactly same thing was said by assembly programmers ? :) –  MichaelT Jul 12 '09 at 17:23
I really struggle to see any comparison between HTML and assembly. HTML is a markup language - it only describes how a page/document should appear. Any performance issues that could be directly related to the HTML are performance issues in the rendering of the content. In the case of browsers, this is down to the specific rendering engine. –  dxbmatt Jul 12 '09 at 18:03
First of all rendering performance affected by size of the DOM smaller html document will render faster , it something compiler could optimize for to produce most compact form of HTML from user markup that it self don't nesesery need to be compact it self. Also compiler reside on a server it could produce version of HTML what is best for some particalar version of the browser –  MichaelT Jul 13 '09 at 10:00
@dxbmatt: HTML doesn't define how a document should appear, that's CSS. HTML defines what the document means. (That's kind of the most important rule to keep in mind when trying to write standards-compliant HTML.) –  Ms2ger Jul 13 '09 at 10:49

What you are describing is a domain-specific language to describe HTML pages.

share|improve this answer
Yes it is a domain specific language, but do you know if this is something that was tried already, and do you think such domain specific language could help? –  MichaelT Jul 12 '09 at 16:31
I started to edit my answer, but I think the DSL may already exist - it's called "HTML". –  John Saunders Jul 12 '09 at 16:43
HTML is the most productive thing we can achive ? –  MichaelT Jul 12 '09 at 16:45
In general, yes. In more specific circumstances, I think we can do better. But HTML is very general and describes a very large variety of pages. I have the feeling (just a feeling, no math behind it) that such a DSL would be equivalent to HTML - one to one mapping. –  John Saunders Jul 12 '09 at 16:47

Let's answer this in a way that's fair to what you want, but respects the ubiquity of HTML.

If what you wish is a high-level language for HTML, they already exist. Any good wiki system has a simplified syntax that abstracts away the "<html><head>...</head><body>...</body></html>" plumbing from the user. This is what PHP was made to do, and most popular blogging and wiki systems use it.

A separate problem entangled in your complaint is that a markup language (HTML) is used as an intermediary in the transmission from application (server) to renderer (client). The intent of the application may be lost, because markup is not code but rather a document description language.

What you propose is a method for the web application to direct its execution on the client-side. There are a lot of historical arguments against this -- freedom of browser/platform choice, need for a standard, privacy/security concerns, and possibly breaking MVC by agglomerating code as the transmission interface.

There is work being done in this area however. Look at XUL, which seeks to solve the problem on Mozilla browsers; also Prism, which is a very early applications framework. Also look at Google's GWT or NaCl, which facilitate the safe integration of "native" code on the web. The problem with all of these imho is that they assign work to the client. My belief is that the only good way to safely have true client-server interaction is either 1) a trusted cloud mediator or 2) virtualization.

share|improve this answer
In theory, GWT provides a means for write-once, run anywhere app development where your original Java code is compiled to the best available, most compatible javascript possible on demand. –  Overflown Jul 13 '09 at 8:17
WIKI language is not exactly what I am after, in wiki language you can produce only wiki articles it very spefic to one purpose I would like to have something what is much more general purpose, I also don't want to transfer any logic to the client I want browser to recive just plain HTML , it just be the beter cleaner HTML. –  MichaelT Jul 13 '09 at 10:14

The whole browser compatibility issues and its ramifications are tied to wars between companies, which by all chances doesnt give any shtick to the developer's pain because its all money and market share for them.

Its not easy to move away from it easily by corporate users and non-tech users.

share|improve this answer

With all due respect I am under the impression that you are comparing apples and oranges. Why? You are stating that modern programming languages take the burden of writing good code from the developer (by applying optimizations). IMHO, this statement is not quite correct: No optimizing compiler can compensate for a developer implementing an O(n²) algorithm where an O(n) implementation would have also been possible.

Back to your original question: I understand your need to build standards-compliant cross-browser web applications with less effort than is needed today. Probably somebody will (or already has) come up with a meta-language, which abstracts some of the complexity of writing HTML, but on the other hand this is already possible today with many of the template frameworks / CMS available. Of course, you still have to create the blueprint of your web site in HTML once so that it can later be used as a template, but that's something a meta-langauge also will not allow you to get rid of (even modern compilers make use of hand-crafted assembly language in some areas).

share|improve this answer
Sorry but i did not get why HTML and assembly compilers are different ? Compilers don't change algorithms this correct but they do help you optimize code by following best practice rules what usaly hand writen. Optimizing HTML is more like method inlining and placing variables into registers instead of main memory and not like algorithm selection. What is a best solution for this problem from the ones available ? –  MichaelT Jul 12 '09 at 16:56

The real problem isn't with writing standars-compliant HTML. The problem is that HTML+CSS is an extremely complex system without a reference implementation, which makes the standard essentially worthless since you can't test against it.

Yeah, you can test your HTML and CSS for syntactic correctness, but unlike programming languages, the rules for what effect a syntactically correct program will have are not unequivocal. The actual rendering rules are subject to interpretation, and so it's guaranteed that there will be browser incompatibilities for the foreseeable future. To cite Joel:


share|improve this answer
I don't want just to produce standart complient HTML. I want compiler that is aware of all browser specific quirks and produce HTML that is correctly displayed in all browsers this a tedius part in HTML production and what that could be automated. –  MichaelT Jul 13 '09 at 10:10
No, it could not be. You'd have to define a meta-language that desribes webpages and a it and the "compilers" that converts it to HTML would suffer from exactly the same problems that currently HTML and browsers suffer - with the additional complication of a nextra layer that makes debugging harder, and which is necessarily always out of date in catching up with browser quirks. –  Michael Borgwardt Jul 13 '09 at 11:38
I am sorry but I probably missing something in you post, the problem with current state of HTML is what standard is not implemented equally in all browsers, but people are capable to produce HTML what is viewed correctly in all browsers relevant to them, they do it by using accumulated knowledge about different browsers behavior. Why we can't take this knowledge and make a automatic compiler from it ? I see it as following flow meta-language = > Compiler => quirksAwareHTML , why it will encounter the same problems ? –  MichaelT Jul 13 '09 at 12:52
Apart from debugging and the catching-up-with-browser quirks problem: the HTML/CSS standard is not interpreted the same in all browsers. How would you ensure that this fictional meta-language is interpreted the same in all compilers (or different versions of the compiler)? Humans don't produce quirks aware HTML by following strict rules, they do it by trial-and-error and seeing if the result "looks OK" after each change. The fundamental problem of HTML is that "looks OK" is not a formally testable condition. –  Michael Borgwardt Jul 13 '09 at 13:07
If meta-language is well defined and has a reference implementation it actually relatively easy to produce compilers what interpret it in the same way,. HTML having ill defined standard so every browser interprets it differently but other programming languages avoid this problem. Humans rely on the trial and error because set of rules is too large for any one to hold it in his head , but actually such strict rules do exist some of them listed in QuirksMode site compiler don’t need to relay on trial and error, it possible to evaluate all rules what are available and produce correct result –  MichaelT Jul 13 '09 at 13:50

GWT, Dojo and ExtJS do exactly what you describe. Yes, they require javascript, but they do allow you to avoid remembering many of the "rules" (to a greater or lesser degree depending on the technology).

GWT especially is a good example, because it doesn't even require you to concern yourself with HTML, CSS or JS at all. You live in pure java land, cross-compile to a web app, and it just works.

share|improve this answer

Your Answer


