📜 ⬆️ ⬇️

About browsers and standards. Martian Headphones

Get ready, now you will see the forerunner of all holy wars on resources where web developers hang out. Pearl Harbor, in comparison with this, will seem like the occasion at a grandmother's family tea party when your stepsister ran out of the room in anger and kissed Mustang a tree in the courtyard.

The upcoming battle will be chaired by Dan Hashamovich, a veteran of Microsoft, who is now leading the team that is preparing you Internet Explorer 8.0. The IE8 team is now in the process of making a decision that lies ideally exactly and exactly on the very line that separates two different ways of seeing the world.

This is the border between "conservatives" and "liberals." This is the boundary between "idealists" and "realists." This is a huge global jihad, dividing members of the same family, tuning engineers against computer specialists, and Lexuses against olive trees .
')
And although there is no solution to the problem, it will be very, very interesting to observe, because 99% of participants in holy wars do not even bother to figure out what they generally argue about. And at the same time, it’s not just entertainment: it’s a “must-have program” for every developer who wants to create applications that can interact with something else besides themselves.

A holy war will escalate around something called “web standards.” Let Den present the problem to us :
All browsers have the “Standards” mode, it is called the “Standards Mode” and is used to get the best possible implementation of the standards by the browser. Each version of each browser has its own Standards Mode, because each version of each browser improves its standards support. There are Safari 3 standards mode, Firefox 2 standards mode, IE6 standards mode and IE7 standards mode are different. We want to make sure that the IE8 Standards Mode is much, much better than it was in IE7.

And the whole problem consists of one small solution - what exactly should IE8 do when it stumbles upon a page that reports support for standards, but, most likely, was tested only for IE7.

What the hell are these standards?

Are there no standards for all types of engineering developments? (There is)
Don't they apply everywhere? (Uh-uh ... m ...)

Why are “web standards” so damn confused? (And this is not only Microsoft’s fault, but your fault too. And John Postel (1943–1998). I’ll explain later.)

No solution. Any decision would be horribly wrong. Eric Bangman at the Arts Technique writes: "The IE team has to balance a fine line between supporting W3C standards and supporting old sites written for older versions of IE." But he is wrong. The face is not thin. Its width is just negative. Nowhere to balance. They will be scolded both for the support of one and for the support of the other.

That is why I cannot take sides in this problem, and I am not going to. But every software developer should learn, at least, how standards work and how standards should work, as well as how we got tied up in this Gordian knot. I want to clarify this problem a bit, and then you will see that this is the same problem that Windows Vista is selling so badly, and the same problem that I wrote about the topic of confrontation between Camp Raymond Chen (pragmatics) and Camp MSDN (idealists ) at Microsoft. MSDN Camp won and now no one can figure out where their favorite menu items are in Microsoft Office 2007. And no one else wants Vista. And all this is the same dispute: You are an idealist (“red”) or a Pragmatist (“blue”).

But let's start from the beginning - think about how to make things interact .

Which things? Yes, any, in fact. Pencil and sharpener. Telephone and PBX. HTML page and browser. A graphical application for Windows and the Windows operating system itself. Facebook and applications for Facebook. Stereo headphones and players.

At the junction of these two things, all irregularities should be smoothed, otherwise they simply will not work together.

Continue with a simple example.

Imagine that you flew to Mars and found that the creatures living there did not invent a pocket player and are still running around with boom boxes.

You understand that this is an attractive business opportunity and start selling MP3 players (only on Mars, they are called Ychniakroooogldely) with stereo headphones. To connect headphones to an MP3 player, you invented an elegant metal plug that looks like this:



Since you control the production of both the player and the headphones, you can be sure that the player works with your headphones. This is the market of ONE-K-ONE type. One player, one headphones.



Suppose you have written the documentation, expecting that third-party companies will make headphones of different colors, since the Martians are very scrupulous in choosing the color of what they stick into their ears.



And when you wrote the documentation you forgot to write that the operating voltage of the headphones should be 1.4 volts. Well, just forgot. And here comes the first inspired manufacturer of 100% compatible headphones. His headphones expect the standard 0.014 volts, and when he tests the prototype, either his headphones explode — or the listener's eardrums — depending on what he takes longer. He makes some adjustments and at random finds a configuration in which the headphones work normally and only a couple of microderates are different from yours.

Over time, there are more and more manufacturers of compatible headphones, and soon we will get a market of ONE-CO-MANY



So far, so good. We have a standard de facto headphone jack. The written documentation is incomplete and inaccurate, but anyone who wants to make compatible headphones can simply plug them into your stereo player and if they work, then all is well - they can be sold and they will work ...

So as long as you do not decide to release a new Ychnnyakoooogldel 2.0.

Ychnyakoooobldel 2.0 will have a built-in phone (yes, Martians also didn’t guess the mobile phones) and the headphones will have a microphone that needs another wire, so you recycle the plug into something incompatible and even terrible in places, but with a lot of space for possible extensions:



And Ychnyakoooogldel 2.0 comprehends a total failure in the market. Yes, he has a cool phone feature, but no one mentioned it. But all treasured their collections of headphones. It turns out the fact that the Martians are sensitive to the fact that they stick in their ears, much more serious than it seemed at first. And by this moment every stylish Martian has a full box of various headphones. For you, they are all equally red, but the Martians are very, very sophisticated in shades of red, so much so that you can not imagine. A modern high-tech home on Mars already even has a standard headphone box. This is exactly what you did not expect.

So, the new plug has no success. Therefore, you quickly come up with a new scheme:



Notice that you split the main core to connect another microphone wire, but the problem is that Ichnyakroooglded 2.1 generally does not know if there is a microphone in the connected headset or not, but it needs to know to enable or disable possibility of phone calls. So, you are writing a small exchange protocol ... a new edition of the device sends a signal to the microphone and looks at whether it has come instead to the "ground"; if it comes, then it’s just headphones without a microphone, so the device switches to backward compatibility mode, in which you can only play music.
It is simple, but at the same time it is communication over the protocol.

And we no longer have a ONE-SO-MANY market.
All stereo devices are made by the same company, so I’ll call it the SEQUENCE MANY market:



Here are some of the MULTI-ORDER markets that you already know:
1. Facebook | about 20,000 applications for it
2. Windows | about 1,000,000 applications
3. Microsoft Word | about 1,000,000,000 documents

There are hundreds of other examples. The main thing to remember is that as soon as the new version of the device comes out on the left side, it should maintain backward compatibility with the old accessories on the right, which worked with the old version, as most likely, the old accessories were not developed with a margin for the next incarnation of the product. Everything is exactly the same as with Martian headphones. You cannot go back in time and replace them all. It is much easier and more flexible to make a new device so that it behaves like an old device when used with old headphones.

On the other hand, since you want to develop, improve functionality, you also need a new protocol for new devices and flexibility in that at the beginning of work it checks whether the connected headphones support the latest protocol.

Microsoft has spent its entire adult life in a multi-market.

But there is one more round - the market is MANY-LONG.

It takes several years. You continue to sell Ychnyakrooogldely at a crazy pace, but now there are a lot of Ychnyakrooogldela clones on the market, for example, FireIchn open-source clone, as well as a whole bunch of headphones, and you all make improvements to the design that require changing the plug and it makes the headphone manufacturers crazy , because that they have to test their products on every clone of Ychniakrooogldela, which requires financial and time costs, and frankly, most of them simply do not have enough time and therefore they check them for Ychnyakoooogldel 5.0 is the most popular, and if it works with it, they are happy; But of course, if you plug in such headphones in FireIchn 3.0 and wait, they will explode in the hands due to one small misunderstanding in the specifications regarding the option, which, in fact, nobody fully understands, and it is called hasLayout . Everyone just knows that when it rains , hasLayout is true and the voltage must increase in order for the windscreen wipers to work. But disputes arose - whether hail and snow are also rain as applied to hasLayout , because it is not specified in the specifications. The FireIchn 3.0 development team considers snow as rain, because you need wipers in the snow, and developers Ychnnyakroulogldel 5.0 - no, because the programmer who wrote this functionality lives in the warm part of Mars where there is no snow and in general he does not even have rights. Yes, Mars also has a driver's license.

And some bore writes a long article in his blog about how to make Ychniakroooogldel 5.0 behave exactly like FireIJn 3.0, by using a bug in Ychniakrooogldel 5.0, because of which Ychniakrooogldel thinks that it rains, if you melt a little snow. It sounds ridiculous, but everyone does so to resolve the incompatibility with hasLayout . Later, developers Ychnnyakoooogldel correct this bug in version 6.0, and you are again at a loss, you have to look for a new bug that can be exploited to make your headphones with wipers work with any device.

AND NOW ... now we have a MANY-SOME-MANY market. There are many players on the left side who do not cooperate , and QUINTILLIONS on the right side. And they all make mistakes , because it is human to err.



And of course this is the situation that has now developed with HTML. Dozens of browsers and literally billions of web pages.



And for all the years of the MANY-CO-MOST market existence, the cries and demands of the “standards” are constantly heard so that “all players” (meaning small players) have equal chances and opportunities to display all 8 billion pages correctly. And more importantly, the developers of those 8 billion pages should test only under one browser and, thanks to web standards, they can be sure that their page will work the same in other browsers without having to test them separately.



You see, the idea is that instead of testing many-to-many, you get testing many-to-standard and standard-to-many, which is much less. Not to mention that your page no longer needs a special browser-dependent code to bypass the bugs of individual browsers, because there are no bugs in this platonic world.

This is an idyll.

But in practice, there is a small problem - there is no way to test the page for standards, because there is no reference implementation that would guarantee that if it works in it, it will work everywhere. It simply does not exist.

So you have to “test” in your head, remembering a bunch of documents describing standards that you probably never read, and if you did, then you didn’t understand.

And these documents are mega-binding. Specifications are full of phrases like : “If a child container (not floating and not absolutely positioned) follows a running one, then the running block becomes the first internal block of the container. A running block cannot enter a container that already includes a running block, or is itself a running one. ”Every time I read this, I am surprised how someone can correctly follow the specifications.

There is no practical way to check whether the page you just wrote should be standards. Yes, there are validators , but they won't tell you what the page should look like. And to have a page where the text clings to each other and does not cost anything exactly, but it is “valid”, it is also of little use. So, all that people do is drive their pages in one, maybe two browsers, until they look normal. And if they made a mistake, which is nevertheless displayed as it should in IE and Firefox, then they will not even be interested in knowing about it.

And there is a considerable chance that their pages will “float” with the release of new versions.

If you ever visited the ultra-Orthodox Jewish communities in Jerusalem, all of whose members swore full observance of every iota of Jewish law, you would know that, regardless of the general agreement that is kosher food, you will not find a single rabbi who would like to have dinner at home with a rabbi from another ultra-right community. And nowadays, web developers are discovering what Jews from Mea Shearim have known for decades: that you follow one book does not lead to compatibility, because the laws are so voluminous, complex and florid that it is almost impossible to understand them all. enough to avoid the pitfalls.

Standards are, of course, a great goal, but before you become standards fanatics you must understand that, due to all the shortcomings of a person, misinterpretations sometimes arise in the interpretation of standards, sometimes confusing and even ambiguous.

The core of the problem is that you think that there is one standard, but since no one can really test for compliance with it, this standard is virtual: it is a platonic ideal and a set of misunderstandings, and therefore such a standard does not serve the desired goal. reduction of the matrix of testing in the market MANY-CO-MANY.

DOCTYPE is a myth.

An ordinary mortal who included the DOCTYPE in his page, saying “this is standard HTML” simply enjoys itself. There is no way to find out if it is standard. And in reality, they say that this page should be standard HTML. What they really know is that they tested it in IE, Firefox, maybe Opera and Safari, and it seemed to work. Or maybe they just simply reprinted the DOCTYPE from the book and have no idea what it means.

In the real world, where people are imperfect, it is impossible to have a standard based only on specification - a clear implementation is needed on which everyone could test. Otherwise, you will have 17 different standards or none at all.

In 1981, John Postel provoked the problem by formulating the principle of reliability (more precisely, the principle of robustness , but in view of the closeness of concepts, hereinafter there will be the "principle of reliability" - approx. Transl. ): "Be conservative in what you do, and be liberal in that what you accept from others. ”With this, he wanted to say that in order to make a reliable protocol, you need to adhere to the specifications as precisely as possible, and at the same time“ forgive ”those partners who do not follow the specifications exactly. Forgive as long as you are able to understand what they want to say.

So, in order to make a paragraph with a small text you need to write <p> <small>, but many people wrote <small> <p> which is technically incorrect (for reasons that most web developers do not understand) but web browsers " they forgave them and made the text small, because it is clear that this is what the people wanted to achieve.

Now we have all these error pages on the network, because all the developers of the first browsers made super-liberal and friendly programs that loved you for what you are and were not particularly upset if you made a mistake. And here we have a lot of mistakes and it turns out that the principle of "reliability" of Postel does not work much. The problem did not pay attention for many years. But in 2001, Marshall Rose finally wrote :
Contrary to intuition, the Postelowski principle of reliability often leads to problems in the deployment of solutions. Why? When a new implementation of something comes out ( for example, html page - approx. Lane ), then it first encounters only a limited set of existing implementations ( for example, browsers - approx. Lane ). And if these implementations ( browsers ) follow the “reliability principle”, then errors in the new implementation ( page ) will remain undetected. The process is repeated many times, but sooner or later a new, not-quite-correct implementation ( for example, a page with hidden errors — note of the translation ) will fall into a less liberal environment than originally. What then happens to explain is not necessary "

We must pay tribute to John Postel for all that he has done for the development of the Internet, and really should not blame him for the unpopular principle of reliability. 1981 is like a stone age. If Postel knew that 90 million people who are not specially trained engineers would create websites and make all these terrible mistakes, and the first browsers would forgive these mistakes and still display the page, because of some unprecedented generosity I realized that this is a wrong principle, and that in fact, the idealists of web standards are right, and the web should have been built on very, very strict standards, and every browser should have been seriously intrusive in demanding these standards from you. And so that those developers who cannot understand what it means to “be conservative in what you do” would not be able to publish their pages until they meet the standard.

But, of course, if it had happened, then probably the web would never have had such a take-off, and we probably would have used the giant Lotus Notes network managed by AT & T.

And in general, if yes if only ... we are where we are. What a difference. We cannot change the past, only the future. Yes, and the future is difficult.

If you were a pragmatist in the Inetrnet Explorer 8.0 team, then the words of Raymond Chen would be engraved in your memory. , Windows XP Windows:
. , . Windows XP. , . : « Windows XP. , , ». , , , , . Windows XP . ( , , 30- . , — Windows XP)

, , :
. , . Windows XP Vista . , . : « Windows XP Vista . , , ». , , , , . Windows XP Vista . ( , , 30- . , — Windows XP Vista )

, 2004, , Vista .

IE?
. 100 . IE8. , Google Maps .



: « IE8. , Google Maps ». , , HTML, Google Maps , JavaScript IE, . IE8. ( . . , — IE7)

, IE8, , , , . , , , , , , , «! IE8! IE8!».

IE 21 . .

, IE . «» .

IE « » «! IE8» — . . , . ! 8 .

IE . ( ) — . - , « », IE8.

, IE8, . , JavaScript, . : , , - .

. , , . IE 6 IE 7 , , « … 17 , IE».

IE 8 — IE, , IE 7, 17 , . , , .

IE 8 , « IE 7». — .

. , , , 4 , .

. IE , - .

… --…

:
IE 8 . , , … . Google Maps , !

… . . . . 98% IE 8 : « — .» -, , «» . . , .

, .

. — , -, , — , . « ! 80% . , , 15 . . !»

— , , . « IE7 -?». … ! !

? . IE8 , , , , IE8 . , , 32% , «, , -, » . , . IE , , .

See you .

, 100% , , . . . - , .

Source: https://habr.com/ru/post/31478/


All Articles