镜像问题为什么前端老觉得后端简单??www.zhihu.com
镜像问题
因为前后端看待问题的方式不同。
前端的复杂度主要在如何优雅地处理
而对于高并发、存储过程等并不十分在意。
而后端的复杂度主要体现在如何完美应对
由于对待」简单「和」复杂「的标准不同,就有了截然不同的评价。
当一个后端不得不调试 CSS 的时候,可能会觉得 CSS 很简单,因为似乎怎么写都可以达到目标。但殊不知由于 CSS 不是正交(non-orthogonal)的特性,有时候很简单的一个写法却会引起某种意想不到的效果,更不谈浏览器兼容性问题等等。
一个著名的例子:外边距折叠(margin collapsing)[1]
HTML:
&The bottom margin of this paragraph is collapsed …& &… with the top margin of this paragraph, yielding a margin of &20px& in between.& &This parent element contains two paragraphs! &This paragraph has a &20px& margin between it and the text above.& &My bottom margin collapses with my parent, yielding a bottom margin of &20px&.& &
The bottom margin of this paragraph is collapsed …&
… with the top margin of this paragraph, yielding a margin of &20px& in between.&
20px&
&This parent element contains two paragraphs! &
This paragraph has a &20px& margin between it and the text above.&
My bottom margin collapses with my parent, yielding a bottom margin of &20px&.&