polymorphism madness

blov · · 411 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I wanted to post this to <a href="/r/programming" rel="nofollow">/r/programming</a> but they only accept links, and I could care less about blogging.</p> <p>First, a short preface. I write a lot of Go code. Not all of it is public and yet very little of it is paid for. Frankly, a number of my hobbies involve programming and Go is my go-to language. But why? A talk by Brad Fitzpatrick a while back with a short mention of the loathsome state of programming, the desire to get out of the game, and my questioning of the time spent otherwise hit a nail for me. Why am I programming in my free time? Why am I writing Go code always for completely random things? Why Go, who really cares?</p> <p>Well, this got me thinking over the coming months about some of the senseless stuff I&#39;ve written via abstractions available to me. Things that seemed great at the time, almost a beauty to behold, but ultimately I look back on and wondered why I even bothered abstracting particular concepts for literally no gain 2+ years later.</p> <p>A tangent from the preface, I don&#39;t mean to come off as abstractions aren&#39;t useful. But, you know, maybe the context is really effin important.</p> <p>So, my story goes, once I wrote a generic solution to messaging on android. No, not text messages between persons, I&#39;m talking about different portions of an application talking to other portions of the same application for various &#34;parts&#34; of said app. Android, in general, facilitates said communication and I built on top of that for a generic interface that facilitated communication across these various &#34;channels&#34;. It wasn&#39;t until a couple years later that I truly realized how this &#34;abstraction&#34; could be expressed in maybe 30+ lines of Java specific to an application and a hell of a lot more readable 2+ years after-the-fact.</p> <p>So, since then I&#39;ve written an annotation processor to generate that 30+ lines of boring boiler plate (but even that, why?), but I&#39;m curious how many people writing any kind of code have looked back on any kind of abstraction and realized the (not?) net-gain it&#39;s afforded them.</p> <p>If you have a story, I&#39;d like to hear it. For, uh ... science, et all...</p> <hr/>**评论:**<br/><br/>ChristophBerger: <pre><p>This reminds me a bit of the old story by Joel Spolsky about <a href="http://www.joelonsoftware.com/articles/fog0000000018.html" rel="nofollow">architecture astronauts</a>. Ok, maybe he exaggerates a bit...</p> <p>I did have some attacks of <em>architecture astronautism</em> in the past, but I feel that it happens much less to me with Go. Go seems to much more support <a href="http://www.joelonsoftware.com/items/2009/09/23.html" rel="nofollow">duct tape programming</a> than over-abstracting.</p></pre>dasacc22: <pre><p>Thanks, it does get a little silly but that put into words exactly what I was trying to work out.</p></pre>Gyrospring: <pre><p>Would event handling be a form of polymorphism?</p></pre>dasacc22: <pre><p>Android provides two independent interfaces for comm depending on your interest in either. Regardless, the question you pose can be generalized in &#34;polymorhism? why?&#34;, which is what I&#39;m exploring with my question.</p> <p>Honesly, I don&#39;t expect much given what I typically see on reddit, but summarizing the human experience based on reedit seems pretty dull-witted so I figured I&#39;d ask. At best, I don&#39;t know what to expect, but that&#39;s life eh?</p></pre>Gyrospring: <pre><p>I felt the same way in Cancun.</p></pre>commentzorro: <pre><p><em>&gt; but ultimately I look back on and wondered why I even bothered abstracting particular concepts for literally no gain 2+ years later.</em></p> <p>I&#39;ll play devil&#39;s advocate. I&#39;d say it&#39;s not for no gain, just not the gain you thought. Abstracting away the concrete and domain specific details is a tremendous learning experience. You get to understand the fundamental problem, how it might be applied to other unrelated situations, and it can be tons of fun.</p> <p>I&#39;d say languages such and lisp, forth, and Haskell exist because someone spent the time abstracting away specifics. And certainly there are branches of math that owe their existence to this playing around.</p> <p>In the end, you might not have gained for your particular problem, but you&#39;ve likely setup a nice set of neural pathways that might come in handy later. </p> <p>I also like the idea of blurring the line between coding and art ... &#34;<em>almost a beauty to behold</em>&#34;. Art gets to exist for no practical reason. [Hey, I&#39;m art!]</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

411 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传