怎樣看待網頁可以查看其源代碼而計算機語言所編譯的程序則不能?
-------
自己才疏學淺,問個問題都讓見笑。還是好好組織一下語言吧。開源經答主賜教,自己連開源都弄不清。不應該用這個詞。如果問題還不準確,請大家不吝修改。
------修改前的問題-----
怎樣看待互聯網的「開源(可以查看網頁的源代碼)」?
看到一個網頁,裡面的一個效果,內容,可以通過查看其代碼模仿甚至抄襲。相對與其他高級計算機語言而言,代碼經過編譯,程序則不能獲取其展示方式的代碼,當然一些反向的不在這個討論之內。這裡說的「開源」,並非開源哈,只是一種即視感。尤其是在前端開發方面。
網頁的源代碼不過是告訴你的瀏覽器如何渲染網頁而已,算哪門子開源啊
開源指的是作者想讓你看代碼的意願(這並不一定包括想讓你方便地修改或者重新發布,那是具體的license的問題),而不是一個既定事實。
function(a){with(a){
a.f=function(b){throw b;},a.i=void 0,a.j=!0,a.k=null,a.n=!1,a.aa=function(){return function(b){return b}},a.ba=function(){return function(){}},a.ca=function(b){return function(c){this[b]=c}},a.q=function(b){return function(){return this[b]}},a.s=function(b){return function(){return b}},a.t=void 0,a.da=[],a.u=function(b){return function(){return da[b].apply(this,arguments)}},a.ea=a.ea||{},a.fa=this,a.ga=function(b){for(var b=b.split("."),c=fa,d;d=b.shift();)if(c[d]!=k)c=c[d];else return k;return c},
a.ha=function(){},a.ia=function(b){b.U=function(){return b.Mj?b.Mj:b.Mj=new b}},a.ka=function(b){var c=typeof b;if("object"==c)if(b){if(b instanceof Array)return"array";if(b instanceof Object)return c;var d=Object.prototype.toString.call(b);if("[object Window]"==d)return"object";if("[object Array]"==d||"number"==typeof b.length"undefined"!=typeof b.splice"undefined"!=typeof b.propertyIsEnumerable!b.propertyIsEnumerable("splice"))return"array";if("[object Function]"==d||"undefined"!=typeof b.call
"undefined"!=typeof b.propertyIsEnumerable!b.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==c"undefined"==typeof b.call)return"object";return c},a.la=function(b){return b!==i},a.ma=function(b){return"array"==ka(b)},a.na=function(b){var c=ka(b);return"array"==c||"object"==c"number"==typeof b.length},a.oa=function(b){return"string"==typeof b},a.pa=function(b){return"number"==typeof b},a.qa=function(b){return"function"==ka(b)},a.ra=function(b){var c=typeof b;
return"object"==cb!=k||"function"==c},a.ua=function(b){return b[sa]||(b[sa]=++ta)},a.sa="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),a.ta=0,a.va=function(b,c,d){return b.call.apply(b.bind,arguments)},a.wa=function(b,c,d){b||f(Error());if(2&
fa)var c={"amp;":"","<":"&<",">":">","quot;":"""},d=document.createElement("div"),b=b.replace(Ya,function(b,g){var h=c[b];if(h)return h;if("#"==g.charAt(0)){var l=Number("0"+g.substr(1));isNaN(l)||(h=String.fromCharCode(l))}h||(d.innerHTML=b+" ",h=d.firstChild.nodeValue.slice(0,-1));return c[b]=h});else b=b.replace(/([^;]+);/g,function(b,c){switch(c){case "amp":return"";case "lt":return"&<";case "gt":return">";case "quot":return""";default:if("#"==c.charAt(0)){var d=Number("0"+c.substr(1));
if(!isNaN(d))return String.fromCharCode(d)}return b}});return b},a.Ya=/([^;s&<]+);?/g,a.Xa=function(b,c){return-1!=b.indexOf(c)},a.$a=function(b){return String(b).replace(/([-()[]{}+?*.$^|,:#&(0==I[1].length?0:parseInt(I[1],10))?
1:0)||((0==B[2].length)&<(0==I[2].length)?-1:(0==B[2].length)&>(0==I[2].length)?1:0)||(B[2]&I[2]?1:0)}while(0==d)}return d},a.eb=2147483648*Math.random()|0,a.fb=function(){return"goog_"+eb++},a.gb=function(b){return String(b).replace(/-([a-z])/g,function(b,d){return d.toUpperCase()})};a.z={Ve:function(b){return b[b.length-1]}};z.wb=Array.prototype;z.indexOf=z.wb.indexOf?function(b,c,d){return z.wb.indexOf.call(b,c,d)}:function(b,c,d){d=d==k?0:0&>d?Math.max(0,b.length+d):d;if(oa(b))return!oa(c)||1!=c.length?-1:b.indexOf(c,d);for(;d&
a.Fb={},a.Gb=function(b){return Fb[b]||(Fb[b]=0&<=db(zb,b))},a.Ib=function(b){return AHb&>=b},a.Jb=fa.document,a.Hb=!Jb||!A?i:yb()||("CSS1Compat"==Jb.compatMode?parseInt(zb,10):5);a.Kb=void 0,a.Lb=!A||Ib(9),a.Mb=!C!A||AIb(9)||CGb("1.9.1"),a.Nb=A!Gb("9");a.E={set:function(b,c){b.className=c},get:function(b){b=b.className;return oa(b)b.match(/S+/g)||[]},add:function(b,c){var d=E.get(b),e=z.slice(arguments,1),g=d.length+e.length;E.lC(d,e);b.className=d.join(" ");return d.length==g},remove:function(b,c){var d=E.get(b),e=z.slice(arguments,1),g=E.EE(d,e);b.className=g.join(" ");return g.length==d.length-e.length},lC:function(b,c){for(var d=0;d&
d.innerHTML=c;if(1==d.childNodes.length)return d.removeChild(d.firstChild);for(var e=b.createDocumentFragment();d.firstChild;)e.appendChild(d.firstChild);return e},a.jc=function(b){if(1!=b.nodeType)return n;switch(b.tagName){case "APPLET":case "AREA":case "BASE":case "BR":case "COL":case "COMMAND":case "EMBED":case "FRAME":case "HR":case "IMG":case "INPUT":case "IFRAME":case "ISINDEX":case "KEYGEN":case "LINK":case "NOFRAMES":case "NOSCRIPT":case "META":case "OBJECT":case "PARAM":case "SCRIPT":case "SOURCE":case "STYLE":case "TRACK":case "WBR":return n}return j},
a.kc=function(b,c){fc(Ub(b),b,arguments,1)},a.lc=function(b){for(var c;c=b.firstChild;)b.removeChild(c)},a.mc=function(b,c){c.parentNodec.parentNode.insertBefore(b,c)},a.nc=function(b,c){c.parentNodec.parentNode.insertBefore(b,c.nextSibling)},a.oc=function(b,c,d){b.insertBefore(c,b.childNodes[d]||k)},a.L=function(b){return bb.parentNode?b.parentNode.removeChild(b):k},a.pc=function(b,c){var d=c.parentNode;dd.replaceChild(b,c)},a.qc=function(b){var c,d=b.parentNode;if(d11!=d.nodeType){if(b.removeNode)return b.removeNode(n);
for(;c=b.firstChild;)d.insertBefore(c,b);return L(b)}},a.rc=function(b){return Mbb.children!=i?b.children:z.filter(b.childNodes,function(b){return 1==b.nodeType})},a.tc=function(b){return b.firstElementChild!=i?b.firstElementChild:sc(b.firstChild,j)},a.uc=function(b){return b.previousElementSibling!=i?b.previousElementSibling:sc(b.previousSibling,n)},a.sc=function(b,c){for(;b1!=b.nodeType;)b=c?b.nextSibling:b.previousSibling;return b},a.vc=function(b,c){if(b.contains1==c.nodeType)return b==
c||b.contains(c);if("undefined"!=typeof b.compareDocumentPosition)return b==c||Boolean(b.compareDocumentPosition(c)16);for(;cb!=c;)c=c.parentNode;return c==b},a.yc=function(b,c){if(b==c)return 0;if(b.compareDocumentPosition)return b.compareDocumentPosition(c)2?1:-1;if(A!Ib(9)){if(9==b.nodeType)return-1;if(9==c.nodeType)return 1}if("sourceIndex"in b||b.parentNode"sourceIndex"in b.parentNode){var d=1==b.nodeType,e=1==c.nodeType;if(de)return b.sourceIndex-c.sourceIndex;var g=b.parentNode,h=
c.parentNode;return g==h?wc(b,c):!dvc(g,c)?-1*xc(b,c):!evc(h,b)?xc(c,b):(d?b.sourceIndex:g.sourceIndex)-(e?c.sourceIndex:h.sourceIndex)}e=Ub(b);d=e.createRange();d.selectNode(b);d.collapse(j);e=e.createRange();e.selectNode(c);e.collapse(j);return d.compareBoundaryPoints(fa.Range.START_TO_END,e)},a.xc=function(b,c){var d=b.parentNode;if(d==c)return-1;for(var e=c;e.parentNode!=d;)e=e.parentNode;return wc(e,b)},a.wc=function(b,c){for(var d=c;d=d.previousSibling;)if(d==b)return-1;return 1},a.zc=function(b){var c,
d=arguments.length;if(d){if(1==d)return arguments[0]}else return k;var e=[],g=Infinity;for(c=0;c&
a.Ic=function(b){if(Nb"innerText"in b)b=Ja(b.innerText);else{var c=[];Hc(b,c,j);b=c.join("")}b=b.replace(/ xAD /g," ").replace(/xAD/g,"");b=b.replace(/u200B/g,"");Nb||(b=b.replace(/ +/g," "));" "!=b(b=b.replace(/^s*/,""));return b},a.Jc=function(b){var c=[];Hc(b,c,n);return c.join("")},a.Hc=function(b,c,d){if(!(b.nodeName in Dc))if(3==b.nodeType)d?c.push(String(b.nodeValue).replace(/(
|
|
)/g,"")):c.push(b.nodeValue);else if(b.nodeName in Ec)c.push(Ec[b.nodeName]);else for(b=b.firstChild;b;)Hc(b,
c,d),b=b.nextSibling},a.gc=function(b){if(b"number"==typeof b.length){if(ra(b))return"function"==typeof b.item||"string"==typeof b.item;if(qa(b))return"function"==typeof b.item}return n},a.Lc=function(b,c,d){if(!c!d)return k;var e=c?c.toUpperCase():k;return Kc(b,function(b){return(!e||b.nodeName==e)(!d||E.has(b,d))},j)},a.Kc=function(b,c,d,e){d||(b=b.parentNode);for(var d=e==k,g=0;b(d||g&<=e);){if(c(b))return b;b=b.parentNode;g++}return k},a.Mc=function(b){try{return bb.activeElement}catch(c){}return k},
a.Tb=function(b){this.Ja=b||fa.document||document};t=Tb.prototype;t.M=Vb;t.za=q("Ja");t.m=function(b){return oa(b)?this.Ja.getElementById(b):b};t.Cu=Tb.prototype.m;t.fi=function(b,c){return J(b,c||this.Ja)};t.w=function(b,c,d){return ec(this.Ja,arguments)};t.createElement=function(b){return this.Ja.createElement(b)};t.createTextNode=function(b){return this.Ja.createTextNode(b)};t.Qv=u(21);a.Nc=function(b){return"CSS1Compat"==b.Ja.compatMode};t.Ua=function(){return this.Ja.parentWindow||this.Ja.defaultView};
a.Oc=function(b){return cc(b.Ja)};t.Nr=function(b){return Mc(b||this.Ja)};t.appendChild=function(b,c){b.appendChild(c)};t.append=kc;t.Dt=lc;t.xo=mc;t.dy=nc;t.removeNode=L;t.GN=qc;t.CE=rc;t.FE=tc;t.contains=vc;t.VN=Lc;a.Pc=function(b,c){b.setAttribute("role",c)},a.Qc=function(b,c,d){b.setAttribute("aria-"+c,d)},a.Rc=function(b,c){var d=b.getAttribute("aria-"+c);return d===j||d===n?d?"true":"false":d?String(d):""};a.M=function(){0!=Sc(this.rZ=Error().stack,Tc[ua(this)]=this)},a.Sc=0,a.Tc={};M.prototype.Rg=n;M.prototype.H=function(){if(!this.Rg(this.Rg=j,this.z(),0!=Sc)){var b=ua(this);delete Tc[b]}};a.Uc=function(b,c){b.rr||(b.rr=[]);b.rr.push(c)};M.prototype.z=function(){this.rrVc.apply(k,this.rr);if(this.Zo)for(;this.Zo.length;)this.Zo.shift()()};a.Wc=function(b){b"function"==typeof b.Hb.H()},a.Vc=function(b){for(var c=0,d=arguments.length;c&
ad.prototype.serializeArray=function(b,c){var d=b.length;c.push("[");for(var e="",g=0;g&
a:{var r=n;if(0==h.keyCode)try{h.keyCode=-1;break a}catch(w){r=j}if(r||h.returnValue==i)h.returnValue=j}}r=new nd;r.B(h,this);h=j;try{if(m){for(var B=[],I=r.currentTarget;I;I=I.parentNode)B.push(I);l=g[j];l.Ye=l.ia;for(var G=B.length-1;!r.ik0&<=Gl.Ye;G--)r.currentTarget=B[G],h=Gd(l,B[G],e,j,r);if(p){l=g[n];l.Ye=l.ia;for(G=0;!r.ikG&
O.forEach=function(b,c,d){if(na(b))try{z.forEach(b,c,d)}catch(e){e!==O.fbf(e)}else{b=O.fd(b);try{for(;;)c.call(d,b.next(),i,b)}catch(g){g!==O.fbf(g)}}};O.filter=function(b,c,d){var e=O.fd(b),b=new Pd;b.next=function(){for(;;){var b=e.next();if(c.call(d,b,i,e))return b}};return b};O.xm=function(b,c,d){var e=0,g=b,h=d||1;1&=g||0&>he&<=g)f(O.fb);var b=e;e+=h;return b};return l};
O.join=function(b,c){return O.toArray(b).join(c)};O.map=function(b,c,d){var e=O.fd(b),b=new Pd;b.next=function(){for(;;){var b=e.next();return c.call(d,b,i,e)}};return b};O.reduce=function(b,c,d,e){var g=d;O.forEach(b,function(b){g=c.call(e,g,b)});return g};O.some=function(b,c,d){b=O.fd(b);try{for(;;)if(c.call(d,b.next(),i,b))return j}catch(e){e!==O.fbf(e)}return n};O.every=function(b,c,d){b=O.fd(b);try{for(;;)if(!c.call(d,b.next(),i,b))return n}catch(e){e!==O.fbf(e)}return j};
O.jM=function(b){var c=arguments,d=c.length,e=0,g=new Pd;g.next=function(){try{return e&>=df(O.fb),O.fd(c[e]).next()}catch(b){return(b!==O.fb||e&>=d)f(b),e++,this.next()}};return g};O.qN=function(b,c){var d=O.fd(b),e=new Pd,g=j;e.next=function(){for(;;){var b=d.next();if(!g||!c.call(i,b,i,d))return g=n,b}};return e};O.$A=function(b,c){var d=O.fd(b),e=new Pd,g=j;e.next=function(){for(;;)if(g){var b=d.next();if(c.call(i,b,i,d))return b;g=n}else f(O.fb)};return e};
O.toArray=function(b){if(na(b))return z.toArray(b);var b=O.fd(b),c=[];O.forEach(b,function(b){c.push(b)});return c};O.$f=function(b,c){var b=O.fd(b),c=O.fd(c),d,e;try{for(;;){d=e=n;var g=b.next();d=j;var h=c.next();e=j;if(g!=h)break}}catch(l){l!==O.fbf(l);if(d!e)return n;if(!e)try{c.next()}catch(m){return m!==O.fbf(m),j}}return n};O.t_=function(b,c){try{return O.fd(b).next()}catch(d){return d!=O.fbf(d),c}};
O.product=function(b){if(z.some(arguments,function(b){return!b.length})||!arguments.length)return new Pd;var c=new Pd,d=arguments,e=z.repeat(0,d.length);c.next=function(){if(e){for(var b=z.map(e,function(b,c){return d[c][b]}),c=e.length-1;0&<=c;c--){if(e[c]&
t.ZN=function(b,c,d){var e=new $d(b,String(c),this.tR);if(d){e.iE=d;var g;var h=arguments.callee.caller;try{var l;var m=ga("window.location.href");if(oa(d))l={message:d,name:"Unknown error",lineNumber:"Not available",fileName:m,stack:"Not available"};else{var p,r,w=n;try{p=d.lineNumber||d.j_||"Not available"}catch(B){p="Not available",w=j}try{r=d.fileName||d.filename||d.sourceURL||m}catch(I){r="Not available",w=j}l=w||!d.lineNumber||!d.fileName||!d.stack?{message:d.message,name:d.name,lineNumber:p,
fileName:r,stack:d.stack||"Not available"}:d}g="Message: "+Va(l.message)+"
Url: &"+l.fileName+"&
Line: "+l.lineNumber+"
Browser stack:
"+Va(l.stack+"-&> ")+"[end]
JS stack traversal:
"+Va(Xd(h)+"-&> ")}catch(G){g="Exception trying to expose exception! You win, we lose. "+G}e.hE=g}return e};t.Jk=function(b,c){this.log(fe,b,c)};t.info=function(b,c){this.log(ge,b,c)};t.jD=u(13);
a.ke=function(b,c){b.log(ie,c,i)},a.le={},a.me=k,a.ne=function(b){me||(me=new be(""),le[""]=me,me.FI(he));var c;if(!(c=le[b])){c=new be(b);var d=b.lastIndexOf("."),e=b.substr(d+1),d=ne(b.substr(0,d));d.CE()[e]=c;c.Xa=d;le[b]=c}return c};a.pe=function(b){M.call(this);this.ha=b;this.Va=[]};y(pe,M);a.qe=[];t=pe.prototype;t.e=function(b,c,d,e,g){ma(c)||(qe[0]=c,c=qe);for(var h=0;h&
那只是前端,
要抄也只能抄個界面而已。
網頁查看到的所謂源碼,只是不得已而為之,這個是html的內容,瀏覽器要顯示各種各樣樣式的網頁,就需要這些html內容,來確定網頁的樣子,這些都是協議或標準規定的,也就是由各個瀏覽器廠家或團體開會決定的。而其他的源代碼,比如說,baidu用來組織baidu首頁用的代碼,你是不可能得到的,這是商業機密,用其他的語言,拼接出網頁在瀏覽器上展示的內容所對應的html內容,然後再在http請求中返回給瀏覽器,瀏覽器解析html的內容,然後渲染並展示給用戶。而baidu是用什麼語言,什麼邏輯和演算法獲得這些數據的,就是商業機密。就像一個黑箱子,瀏覽器顯示的是箱子表面的東西,你永遠無法知道箱子裡面是怎麼生成這樣的內容的。至於有的可以反編譯,有的不可(其實並不是不可,而是難易程度不同),不管怎麼樣,都要編譯成可執行文件,可執行文件裡面必然是機器碼,都是可以反編譯為彙編的,要是有儘力,可以去分析這些彙編碼,但是現在的應用,動輒幾百M,一個人終其一生都不可能讀完,所以是整體不可讀的。有精力,能力和時間干這些事的人,自己就能寫一套了,誰還去研究這些東西。
抄只能抄個死的,你把百度的前端抄過去有什麼用,能返回搜索結果么
即視感,開源,這兩個詞好像你都沒有理解是什麼意思
To delve a bit into the history part, the early WWW was developed mostly from work in academia, instead of commercial RD. There was no profit motive to obscure the source code, like there is for Flash or Microsoft Word. Basically, computer code usually starts out human-readable unless there is a specific reason to make it not -- in the case of programming languages, they have to be compiled into computer bytecode to be run by CPUs anyway, and so it isn"t necessary to distribute human-readable source code with the compiled programs. With markup and scripting languages like HTML and JavaScript, however, they were designed in such a way that the source code itself is transmitted, not a compiled binary, and then it"s up to the browser to interpret the source code into machine code after download.
It certainly did not HAVE to develop this way, and we are lucky that it did. Before the WWW, the world was a filthy mess of BBS portals, Gopher sites, and random fingerings of old white people with beards. It was the dark ages of computer networking, and people who wanted information would either have to call up random computer networks and use their special BBS software, or else hope to be connected to the nascent academic Internet or something like CompuServe or AOL.
But a renaissance would soon arrive: a knight called Tim appeared and sought to unify the unwashed masses into a glorious kingdom of interconnected info-peasants. So he looked at things like early sci-fi and Apple HyperCard, previous attempts to mark up documents with extra information like images and cross-references so they can be easily browsed in a non-linear format. He proposed something called HTTP and HTML, in which documents could be easily written by anybody, cross-linked and distributed across the growing Internet. He didn"t give a flying fuck about piracy and obscuring source code. He wanted people to write information and make it available for everyone else. Fast forward a few years, the Netscape company decided this was a pretty cool idea and made their Navigator software available to everyone. Then an advertising company called GeoCities offered free hosting to everybody, so now kids everywhere made their own HTML pages using this ancient, open technology and then it all just kind of blew up and became tradition. CompuServe, AOL, and to some lesser degree Java and Flash all tried to make their own networks and formats that could not be so easily written and read by untrained humans, but in the end the widespread public adoption of open HTML and HTTP won out just from sheer momentum.
But anyway, as ed points out, the HTML is just the last step of the process -- displaying the information. A lot of the hard work happens serverside, between databases and hypertext preprocessors (computer programs that format information into HTML for transmittance), like PHP or ASP.
我看不懂程序員們的回答,但我也來回答一下:
首先,網頁是用那些「碼」經過瀏覽器解釋後呈現出來的,這一點沒錯。從這一點說,html+CSS的確算「源碼」。
它們能夠被我們輕易地看到,是因為它們不怕抄。或者說商業已經證明了去抄它們的價值不大。
相比之下,一些商業軟體之所以不敢「開源」,一是怕你抄它們,自己出產品;二是怕你把它們的產品給搞壞。
我只能「看待」到這個層面上。
推薦閱讀:
※開源與共產主義的本質區別是什麼?
※商業項目對使用開源軟體的態度和使用範圍是怎樣的?
※諾基亞宣布在 symbian.nokia.com 開放 Symbian 手機系統源碼,而 Android 3.0 暫時閉源,二者開閉源的戰略是為什麼呢?
※如何用開源飛控PIXHAWK進行開發?
※使用我的源代碼然後把我舉報了,他們怎麼想的?