TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Magic in software development

37 点作者 skilldrick大约 14 年前

5 条评论

jerf大约 14 年前
I'm going to mention what I think the other big definition of magic is, because I haven't seen it spelled out yet. It's when there is something that is occurring in code but you have no handle on how to follow it back to where the magic occurred. For instance, you write a class that looks something like<p><pre><code> class A: thing1 = 0 thing2 = 0 </code></pre> but somewhere in between your definition and your usage, the class is suddenly an ORM mapping onto a database. As cool as that may be, just looking at class A, you have no idea where to look for that behavior. If you had to subclass something to get that behavior, you could have looked there; if you had to call a function on the class to get this behavior, you could follow it back from there, but when you have this sort of magic you can't. The forensic trail has gone cold.<p>If you think about it, you can see how the two definitions are related; this sort of magic tends to stay something you don't understand because you don't just naturally pick it up over time, you must make great effort to figure out what the problem is. But it's a different problem with a different solution, certainly.<p>Generally the two places this magic lives is in some all-encompassing framework, and in the language itself. Perl has numerous magical constructs, some of which turn out to be very difficult to even search for in the docs because it isn't even obvious what the operator is. The flip-flop operator comes to mind: <a href="http://perl-tricks.blogspot.com/2007/01/flip-flop-operator.html" rel="nofollow">http://perl-tricks.blogspot.com/2007/01/flip-flop-operator.h...</a> If you encounter that for the first time you can be <i>really lost</i> trying to figure out how the list construction is occurring and it's not at all obvious what to search for.
wccrawford大约 14 年前
I've seen some backlash against 'magic' lately and it surprised me. 'Magic' doesn't need to be understood to be used.<p>I don't care how my car works, just that it gets me to work every day. If it breaks day, I have the choice of learning another craft (car repair) or paying someone that already knows it.<p>Likewise, if I find a bug in Ruby's base code, I can choose to learn enough about Ruby's code to fix it, or write a bug report and let someone else.<p>I'm not advocating ignorance, I'm saying it's a perfectly valid option given that we aren't immortal.
评论 #2493007 未加载
评论 #2492983 未加载
评论 #2492946 未加载
happy4crazy大约 14 年前
Nick, I'm reading two really cool books that you might enjoy when you're in a "bottom-up" phase: The Elements of Computing Systems [0] and Computer Systems: A Programmer's Perspective [1]<p>[0] <a href="http://www1.idc.ac.il/tecs/" rel="nofollow">http://www1.idc.ac.il/tecs/</a> [1] <a href="http://csapp.cs.cmu.edu/" rel="nofollow">http://csapp.cs.cmu.edu/</a><p>CSAPP is unfortunately a hulking $100 hardback, but the authors have put close to 200 sample pages online. Despite looking a bit fearsome, it's <i>extremely</i> clear. And TECS is just awesome--they take you all the way through building (in a hardware simulator) a simple 16bit computer!
评论 #2493501 未加载
skilldrick大约 14 年前
Just so people know, I'm not talking Rails magic here - more the idea that there's stuff we don't understand that's going on that to all intents and purposes is magic. In other words:<p>&#62; anything below your current level of abstraction that you don’t understand
gfodor大约 14 年前
I hate the phrase "law of leaky abstractions." Where is Joel's peer reviewed article containing a mathematical proof describing leaky abstractions?
评论 #2493729 未加载
评论 #2493044 未加载
评论 #2493013 未加载
评论 #2493402 未加载
评论 #2493124 未加载