7 ms·
pg's stated before he treats HTML as nothing more than object code. If it runs acceptably on all platforms, who cares what it looks like?
by aston 18y ago
pg's stated before he treats HTML as nothing more than object code. If it runs acceptably on all platforms, who cares what it looks like?
- kwamenum86 18y agocode that does not validate is more lielly to break with browsers updates.
- andrewtj 18y agoIn my experience preemptive fixes are akin to procrastination when there's no empirical evidence to necessitate the change.
- michaelneale 18y agothat's an awesome quote - can I borrow it ??
- andrewtj 18y agosure
- run4yourlives 18y agoThat assumes that there's extra work in coding to standard. In fact, it's quicker to do so.
- tomjen 18y agoReally - adding a doctag is faster than not adding it? That seems incorrect to me.
- andreyf 18y agoI think gp is talking about the long-run. That is, getting things to render right on all browsers, on all devices, printed, etc. Have you ever tried printing a thread? It's bearable, not certainly but pretty.
- run4yourlives 18y agoThat's like saying you don't indent your code blocks because hitting tab is slower than not hitting tab. The point being that there is a lot more to development than keystrokes. But let's user your argument anyway: what's faster: <div id="content">content</div> or <table id="content"><tr><td>content</td></tr></table> Now, lets say I want to move the table text from left to right alignment. While you're mucking around in your code, I pull up the css file and add a line.
- kwamenum86 18y agoWe have web standards to prevent browser bugs. Ironically sticking to standards 100 percent of the time often causes buggy visual display in some browsers. Standards are supposed to make things easier but the browsers have been pretty slow in complying. That does not mean that standards are not a good idea. The lack of empirical evidence is due to that non-compliance. The same browser sometimes allows non-compliant code and chokes on valid code. This is a coordination game (just like driving on the right side of the road). If everyone complies (developers, browsers, etc.) things work. If enough don't, everything breaks.
- deleted 18y ago[deleted]
- eli 18y agoand code that validates is likely to break with certain current browsers :/
- kwamenum86 18y agogood point- but you can always figure out a way to write valid cross-browser code. it's difficult to tell whether or not the effort is worth it because some "broken" code works well in all browsers and there is no reason not to expect this to continue.
- Jem 18y agoReally? My valid code doesn't have any problems in current browsers.
- eli 18y agoAnd the hilariously invalid intranet app I built in 1997 doesn't have any problems in current browsers either. What's your point? I'm not saying it's impossible to write valid code that works (duh). But having code that validates doesn't exempt you from browser bugs and quirks. And sometimes it makes life quite a bit harder.
- run4yourlives 18y agoThat would be a good argument if it were true, but most of those invalid 1997 apps don't work at all in any browser but IE. An now, they're a nightmare to upgrade.
- Jem 18y ago> What's your point? That the problem is with your coding. Invalid or not, if you can't make it work properly that's down to you and bugger all to do with validity.
- daleharvey 18y agoit would be nice to be able to use an xml parser to screenscrape, i mean, missing alt tags dont really matter, but not having to write silly regexs to strip out the data you need over simple xml queries is a plus
- staunch 18y agoUse any decent HTML parser.
- daleharvey 18y agothey arent anywhere near as ubiquitous as xml parsers
- deleted 18y ago[deleted]
- fizx 18y agolibxml2 has an html parser. Everything(ish) has a libxml2 binding. The real PITA about scraping HN is that there's hardly any id/class attributes and you end up with td:nth-child(3).
- snprbob86 18y agoFor Python, use BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/ http://www.crummy.com/software/BeautifulSoup/ Otherwise, try HTML Tidy: http://tidy.sourceforge.net/ http://tidy.sourceforge.net/
- eli 18y agoHpricot for Ruby: https://code.whytheluckystiff.net/hpricot/ https://code.whytheluckystiff.net/hpricot/ But, yeah, Tidy does a darn job of turning just about any HTML into XHTML.
- weavejester 18y agoIan Bicking seems to consider lxml superior to BeautifulSoup: http://blog.ianbicking.org/2008/12/10/lxml-an-underappreciated-web-scraping-library/ http://blog.ianbicking.org/2008/12/10/lxml-an-underappreciat...
- kleevr 18y agothough I'm sure pg's concept of object code is outpacing-ly more resolute than my own,... I really do think I agree.
- ashu 18y agoThat (= treating as object code) does not preclude producing validating HTML. In fact, on the contrary, that is the only way (IMHO) one can produce validating HTML - if your HTML all goes through a common piece of code for rendering tags. See AppJet's HTML producing JS functions, for example.
- pxlpshr 18y agoPG is brilliant and everyone has their own methodology, but there are a lot of reasons to not use tables aside from standards. Just because someone gave insight into their method, does not mean it's universal. Horses for courses... For one, tables are excess bloat... as your site scales, those small kb turn into big bandwidth savings. Two, code uniformity is important when you have multiple people working on an intensive design and efficiency is critical. XHTML/CSS is practically the new table for new developers entering the market. And three, as we age we get stuck in our ways. Doesn't surprise me PG may prefer tables. It took me 3 years to wean off of them... but the decision was for the better and I would never go back to tables, except for data display. :)
- bradgessler 18y agoHAML templates are object code-ish and those render properly. It is certainly possible to write a chunk of code that maps objects into valid XHTML. Through a style sheet on it and you're done; its not like HN has a complicated page layout.