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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Your code may be elegant, but mine works

164 点作者 mendicantB超过 11 年前

71 条评论

freyrs3超过 11 年前
Reducing software development practices down to these cute catchphrases is a bit disingenuous. If you're writing throwaway code for a client with loose constraints and a tight deadline you'll write code differently then you would when you expect to maintain a long term relationship with a client who expects a high degree of correctness. I'm tired of these trite articles espousing some cute mantra holds as if it's some universal property of software development.
评论 #7185205 未加载
评论 #7185062 未加载
评论 #7185931 未加载
评论 #7187146 未加载
评论 #7185650 未加载
candybar超过 11 年前
The main reason that I agree with this is that developers are, as a group, the boy who cried wolf. It&#x27;s not that technical debt doesn&#x27;t matter or code quality doesn&#x27;t matter but so many developers complain about technical debt and code quality when their concern is irrelevant or flat-out wrong that it&#x27;s difficult to distinguish a legitimate concern from complete BS.<p>Developers very often use technical debt or doing the right thing or similar arguments as an excuse not to understand an existing codebase and past choices, to convince management or fellow developers to rewrite something that doesn&#x27;t need to be rewritten, or to buy time to learn and try new technologies&#x2F;methodologies&#x2F;patterns that are supposed to be better without understanding tradeoffs or to satiate their desire to overengineer and build a cathedral, when a simple cart would suffice. These efforts acrrue, rather than pay off, actual technical debt. A simple hardcoded one-off is a lot easier to throw away or fix than a half-assed &quot;elegant&quot; design with configuration options and tight coupling everywhere.<p>All this means developers and managers are correct to be skeptical when another developer talks about technical debt as a reason that they can&#x27;t do something quickly. It&#x27;s not that elegance and technical debt and doing the right thing, etc, don&#x27;t matter.
评论 #7185980 未加载
评论 #7185575 未加载
评论 #7185560 未加载
评论 #7186284 未加载
RyanZAG超过 11 年前
I managed to read the article before it went down, it was a pretty good read. Hopefully it comes back up soon.<p>Anyway it makes a good point that business objectives come before &quot;best practices&quot; which I agree with, but you need to be careful when cutting corners that you don&#x27;t actually sabotage your business objectives. The real discussion is actually on a risk level: if I cut corner X, I can potentially make revenue Y unless cutting corner X causes a problem and I incur loss Z. Cutting that corner is only good if<p><pre><code> P(no problems | cutting corner X) * Y &gt; P (problems | cutting corner X) * Z </code></pre> If this equation looks tough, it&#x27;s because it is tough. This is not an easy decision and you really need to be on top of your game to choose correctly. Alternatively, Y must be much bigger than Z and you have some faith in your shortcut. But for most dev work, a lot of the time you&#x27;re going to be getting that equation wrong if you just guess it and it&#x27;s why so many experienced devs will tell you not to cut corners.
评论 #7185230 未加载
评论 #7187244 未加载
评论 #7185161 未加载
评论 #7185173 未加载
romaniv超过 11 年前
<i>If the project is late, it&#x27;s not done. Period.</i><p>Bullshit. Most deadlines in software engineering are fake. There are some that aren&#x27;t, but they are exceptions, not a rule. If you&#x27;re writing all your code as if every deadline is the Judgment Day, you&#x27;re doing software engineering wrong and not making the right trade-offs.<p>The unfortunate reality is that there are some engineers who will gladly deliver software 5% faster and 600% worse just because it makes them look good with the management. They justify their behavior by all kinds of BS, but in the end it hurts the industry, their clients and the society at large.<p>(There is another breed of engineers that will deliver software 600% slower and 200% worse because of overcomplicated design. Yeah, that&#x27;s also a pathology. But it&#x27;s not like you have to choose only between these two pathologies.)
评论 #7185977 未加载
viraptor超过 11 年前
He presents so many false choices it&#x27;s not even funny. (also we&#x27;re adults, either you really want to fucking write it, or don&#x27;t - stars don&#x27;t help)<p>&gt; If the client needs a Christmas promotion, and you deliver the best product in the history of promotions -- on December 29th -- it&#x27;s worthless.<p>There&#x27;s almost always another option - if it&#x27;s going to be a complete mess that will give everyone additional work in January, then maybe the scope needs to be cut and the remaining features polished.<p>Even if the code is completed, it can be worthless (or worse):<p>- if it crashes your whole site for all users, rather than just the promotion part<p>- if it exposes security issues<p>- if it not only fails on edge cases on the day, but wakes up your on-call people and spoils their christmas with work<p>&gt; And taking it a step further, a veteran programmer should know when and, most importantly, how to cut corners, if needed, to meet the deadline. Which brings me to my next point: over-engineering.<p>It must be great to work at a company that only has fully aware veteran programmers that never make mistakes when cutting corners. It&#x27;s a shame there&#x27;s no recruitment link.<p>&gt; This way, though you may be accruing technical debt, you are also accruing revenue immediately, and you can reconcile the debt over time.<p>A couple of paragraphs before he talked about limiting scope actually. Yet, we&#x27;re back to the only balance most people talk about - time and money (expected revenue from change). I&#x27;ve seen something different everywhere. You talk about technical debt, you plan to get rid of it, then another big idea comes and you add more technical debt to get the shiny feature out. Getting rid of technical debt happens years later when people simply cannot live with the issues - they turned from annoyance that takes you 5 minutes to workaround into company-wide issues that block releases for days.<p>He&#x27;s also ignoring the fact that the technical debt is cummulative - every time you do something quickly you add a couple more minutes to the every following time you need to work on the same code. Sure - it may allow to get <i>this</i> feature out quicker, but it will also <i>force</i> you to cut corners on the next feature - because you don&#x27;t have the abstractions you need available.<p>I&#x27;m tempted to assume that the author never really had to deal with the issues someone else left in the code, because they also thought they&#x27;re veteran programmers and know where to cut corners.
评论 #7187241 未加载
Draiken超过 11 年前
The code is elegant AND it works, so it&#x27;ll beat the one that just works every time.<p>This kind of post is always the same, but any decent developer knows when you have to just &quot;get it done&quot; and when you should take time to make it the right way. And of course, that dirty code will be refactored later on.<p>Always using the &quot;f<i></i>*ing works&quot; strategy just means you&#x27;re mediocre at writing code. Either because you led the management team to think anything can magically be built in a &quot;hackathon&quot; or you just don&#x27;t care about what you build.
评论 #7185073 未加载
MrZongle2超过 11 年前
My code might not be that elegant, but it&#x27;s <i>maintainable</i>.<p>I&#x27;ve followed &quot;hey, it works&quot; developers who knocked out functionality quickly. Their by-product was Lovecraftian code.
评论 #7185249 未加载
评论 #7185505 未加载
评论 #7187724 未加载
j_baker超过 11 年前
Your code may f&#x27;ing work, but my code works <i>and</i> is elegant. So what if my code takes a little bit longer to write? From a technical perspective, it&#x27;s easy to see how this is good. Spending a little bit of time to make your code better will save you hours if not days in the long run.<p>I also have to question whether this is really good from a business perspective. &quot;First mover advantage&quot; really is overrated. Rather than cutting corners to launch your product a couple of days sooner, perhaps you should be focusing on the long term.<p>Granted, there are all kinds of caveats we can think of. For example, very early startups don&#x27;t have the option to focus on the long term and just need to ship something. But even then, putting in a little bit of time up front to polish your code will greatly help your velocity for your next couple of features. You are planning on having more features past the first couple, right?
raganwald超过 11 年前
<i>Something important is almost never mentioned in all the literature about programming and software development, and as a result we sometimes misunderstand each other.</i><p><i>You&#x27;re a software developer. Me too. But we may not have the same goals and requirements. In fact there are several different worlds of software development, and different rules apply to different worlds.</i><p><a href="http://www.joelonsoftware.com/articles/FiveWorlds.html" rel="nofollow">http:&#x2F;&#x2F;www.joelonsoftware.com&#x2F;articles&#x2F;FiveWorlds.html</a>
评论 #7186695 未加载
whyme超过 11 年前
Great article.<p>Note that much of the attitude comes from a belief that what is good for the company is ultimately good for the engineer.<p>However, I&#x27;ll suggest that&#x27;s not always the case. Take for example one of the OA&#x27;s reflections:<p>&quot;<i>Technical debt should be weighted against the actual ROI, because in many cases it is more cost effective to launch early. This way, though you may be accruing technical debt, you are also accruing revenue immediately, and you can reconcile the debt over time.</i>&quot;<p>Unfortunately, dependant upon your company, that last part may never happen and if I were to frequently experience that at a company, well, you better believe I would rather quit and if I couldn&#x27;t quit I still would rather put my foot down and pump the tech debt argument for all it&#x27;s worth, otherwise, in the longer term, working there would be a living hell.<p>I know I&#x27;ll get a lot of flak for this take, but all I can say is that while I&#x27;ve quit companies like that, I understand why some people couldn&#x27;t do the same, and at that point it may require some tough love people management in effort to create a brighter future with a healthy work place.
评论 #7185583 未加载
tdumitrescu超过 11 年前
&quot;This way, though you may be accruing technical debt, you are also accruing revenue immediately, and you can reconcile the debt over time.&quot;<p>The last part of that statement is troubling, because it happens so rarely. I think a lot of devs want to lean towards more engineering &quot;up-front&quot; because they&#x27;ve been smacked repeatedly with the business reality that the first version of that code is what you&#x27;re going to be stuck working with, and building on top of, for a long time.
评论 #7185080 未加载
buckbova超过 11 年前
As a database architect I disapprove of this message.<p>Nearly everything is revisited and changed at some point over the life of the product. If the initial design is a hack or not well thought out, the change will likewise be uglier than the original code.<p>Even worse, if the original code is not understood by the next developer, it will be thrown out and rewritten.<p>Take the extra time in the early stages to design, think about fault tolerance, possible future enhancements, extensibility, robustness, reusability, etc. It will pay off.<p>Yes I over engineer nearly everything I design and yes my deadlines are met. With an elegant design, it is often easier to make late changes on a project. If you follow understood design patterns other people can jump into a project and pick it up right away.
lostcolony超过 11 年前
I live by a comment Joe Armstrong made on this (from Erlang and OTP in Action):<p>&quot;Make it work, then make it beautiful, then if you really, really have to, make it fast.&quot;<p>(The quote continues &quot;90 percent of the time, if you make it beautiful, it will already be fast. So really, just make it beautiful!&quot;)
评论 #7185862 未加载
评论 #7185582 未加载
评论 #7185466 未加载
badman_ting超过 11 年前
Hmm. It&#x27;s not that I disagree as such, but more that people who talk like this tend to be terrible cowboy coders. But I agree that developers can be annoyingly fussy about things that actually do not matter at all. No argument there.<p>Plus elegance is often a bullshit notion and when people say it what they really mean is &quot;what I personally like&quot;.
nateabele超过 11 年前
I used to work at OmniTI. The real irony of this article is that it was written by a guy who&#x27;s (in)famous for his indecipherable Perl one-liners.<p>I think that&#x27;s about all that needs to be said.
评论 #7185359 未加载
programminggeek超过 11 年前
This is a great excuse to write terrible code that &quot;works&quot; until it goes out and breaks. Then it doesn&#x27;t work because you saved a little bit of time by cutting corners.<p>What is the cost of it breaking? $0? $1,000? $10,000?<p>What is the cost to fix the broken code?<p>What is the cost to maintain it?<p>How much developer time do you waste down the line because they have to fix the &quot;working&quot; code?<p>I say these things because I&#x27;ve seen this attitude expressed in a large codebase and it sucks a lot to work with and has wasted many hours of developers&#x27; lives.<p>Technical debt is almost never paid back. Just know that going in to whatever you are building.
评论 #7186956 未加载
gamerdonkey超过 11 年前
I&#x27;m honestly sorry I gave that a pageview.<p>It&#x27;s an article chock full of caveats (<i>Best practices vary wildly across the board, except for the ones any decent programmer obviously knows.</i>), straw-men (<i>Someone spending a week to implement caching on a 20-row table probably wasn&#x27;t crafting elegant code anyway.</i>), and contrived anecdotal examples (<i>Christmas apps must be out by Christmas. My God, what a breakthrough. Most projects are not nearly this straightforward.</i>).
Ologn超过 11 年前
&gt; &quot;You hate testing!&quot; <p>I started working as a Unix sysadmin in 1996, and while I have always written programs, and have been doing so more heavily lately, I never wrote a program with someone else before. All of my programming has either been programs completely written by me, or small patches sent to existing open source projects. The purpose of testing aside from the most rudimentary always eluded me.<p>A few months ago I wrote my first program along with a good, professional programmer. I would code, he would code, I would code. He was good, but I noticed some of his changes would break my code. It occurred to me that testing is something of a communication device. I create functionality, I implement the test, then I tell other commiters to run the test suite before commiting code. If the tests do not complete, they know their code will break functionality I made.<p>I guess this is obvious, but when I read top reasons to do TDD etc. it is usually not mentioned as a prominent reason to do testing, if it is mentioned at all. I do not find tests beyond the most simple kind helpful in my code, but it starts becoming more useful when you have other people modifying the code.
评论 #7186860 未加载
mattgreenrocks超过 11 年前
Cache: <a href="http://webcache.googleusercontent.com/search?q=cache:zWk8w063SukJ:omniti.com/seeds/your-code-may-be-elegant&amp;hl=en&amp;gl=us&amp;strip=1" rel="nofollow">http:&#x2F;&#x2F;webcache.googleusercontent.com&#x2F;search?q=cache:zWk8w06...</a><p>Actual article text is a bit more nuanced than the linkbait title. I still hate reading sentiments like these because they appeal to the lazy parts of ourselves that don&#x27;t need any additional encouragement. It&#x27;s like people revel in their own laziness and failure to follow-through on some things.<p>Professionals finish the job, regardless of how they feel.
dpacmittal超过 11 年前
I must share an anecdote. A recent project was assigned to me which was outsourced to a consulting company, they ditched the project after 80% completion. I was required to do the rest. I went through the code and it was horrible. They had no concept of DRY principle - little code pieces were copy-pasted everywhere. There was no naming convention, variables were randomly names, in some places they made use of ORM, other places had raw SQL queries used with mysql_query() calls. It was a gigantic mess. If the code would&#x27;ve been organised properly, the rest 20% would&#x27;ve taken me 10 days, now I&#x27;m not sure how long it&#x27;s going to take. Even though the code works and whatever they did is functional, but its light years away from maintainable. &quot;Mine works&quot; isn&#x27;t always a good solution.
mcgwiz超过 11 年前
Yes yes, done is better than perfect.<p>However, it helps tremendously for imperfect code to exist in a disciplined higher-level organization. In particular for OOP, this means interface and package&#x2F;assembly responsibilities should be clearly-defined and leak-free. To me, this is the minimum ideal--it may never be definitively achieved, but one should aim for no less. Then, all manner of code abominations can be hidden and compartmentalized. Various components can be improved and cleaned at will, without rippling out destructively throughout the codebase.<p>This means some shortcuts are not allowed, and time to delivery will increase slightly. But those are the shortcuts that create spaghetti-code and tend by far to incur the greatest debt. So I see this simple minimum bound as a good 80&#x2F;20 tradeoff for maintainability.
moron4hire超过 11 年前
The difficulty of changing code is directly proportional to the amount of code that has to be changed. This is almost tautological.<p>So, 6 months ago, perhaps the least difficult thing to do to make a new spreadsheet report was to copy and paste the first one and change a few bits of the query. Repeat 10 times. Management is happy, look how many reports we churned out. Maybe you thought about making a generalized reporting system or something, but your boss was pressuring you. &quot;It&#x27;s so simple, just do the simplest thing. Just make it work.&quot;<p>But now that we have a dozen reports, that asshat in management says he wants graphs on these reports, even though he told us 6 months ago &quot;no way in hell&quot; would he ever want graphs on these reports, now he&#x27;s telling us we&#x27;re &quot;such typical programmers, no fucking common sense.&quot; Suddenly the change isn&#x27;t so easy, we have to touch a metric shit tonne of lines of code.<p>Technically speaking, it&#x27;s going to be fewer lines of code to change to copy-pasta the graphs into all of the existing reports. But we only need to get burnt once to realize that this management douchebag is going to try to burn us again in the future. So, we figure it&#x27;s only a small percentage more difficult to completely rewrite the reporting system from scratch. And then it will be easy to add new features in the future.<p>He is correct in one sense, it should have been done that way in the first place, but that is the nature of getting burnt, you put your trust into someone who was untrustworthy. The management asshole put pressure on you to get the &quot;simple&quot; reports out fast, slow-rolled you on the additional reports, then doesn&#x27;t want to hear &quot;excuses&quot; or &quot;details&quot; or anything other than &quot;the job is done.&quot;<p>So that&#x27;s where so-called &quot;over engineering&quot; comes from. It&#x27;s not. It&#x27;s self preservation. And at your next job, you&#x27;ll remember it should have always been that way, and you dig your heels in on every design decision. And suddenly you&#x27;re &quot;that guy&quot; who is always saying &quot;we tried that at our last job and it didn&#x27;t work.&quot;<p>I have a policy that I always say I can get the job done. I never tell the client that they can&#x27;t have what they want. But I never compromise on quality. What you want takes a certain amount of effort to create, make sure it&#x27;s good, and make sure it doesn&#x27;t impede our future efforts. Working in this way ensures I establish a consistent expectation for how the work will go and the quality of the work over the lifetime of the project. Consequentially, I get the work done on time and everyone is happy with it, almost always.
评论 #7186892 未加载
drcongo超过 11 年前
This service is temporarily (and ironically) unavailable.
评论 #7184899 未加载
评论 #7185255 未加载
ebiester超过 11 年前
...unless your sloppy code hides a security bug which, when exploited, costs them money.<p>When we work hard to write elegant code, we discover the patterns that allow us to write better code when crunch time comes.
j45超过 11 年前
Clever architecture &gt; Clever code, especially when clever architecture minimizes dependancies and requirements.<p>Since reading code is infinitely harder than writing code, the next step that clever coders need to think of is not for themselves, but for others who will continue to work on what they do if they truly want to be working on other new and interesting things.<p>I haven&#x27;t found my code gets to be automatically &quot;hacky&quot; if it &quot;works&quot; and isn&#x27;t obsessed with elegance first. It&#x27;s usually simpler and approachable by a greater number of decent programmers that can continue on it.<p>97% of the time the performance worries we have will never come to fruition, software rarely gets that kind of pressure, and very few frameworks (I hope) are that brutal.<p>Hiding what I do in a clever line of code that slows someone else from improving it, or taking a small 10-40 ms hit for something far more readable and editable. If it&#x27;s a part of the logic that needs further optimization later, it&#x27;s ready and willing be improved easily.<p>One stinking reality is software is just like hardware -- it will always hit its limits and fail. You can be reasonably kind to your future self, but not really prematurely optimize everything before it happens, and instead of making our own lives easier as developers, it should really be about the end users first.
yason超过 11 年前
There&#x27;s basically just one golden rule: a programmer tries to minimize his total amount of work (because then s&#x2F;he has more work capability available for any of the more interesting stuff).<p>This applies to throwaway code vs. maintainable code as well.<p>In programmer&#x27;s head there&#x27;s a <i>running judgement ongoing</i> while crafting something new: there are constant decisions on if cheating with quick&#x27;n&#x27;dirty hacks is the way of least effort for one part of the software or whether the total effort will be minimised by expending more effort now to do it in a more reusable way that saves effort later.<p>For example, some parts are just written quickly to test another part more quickly, and that another part might be contained in a module whose interfaces are really worth designing first and coding later. But some of the code inside of that could be replaced by a quick hack for now. Good things and bad things interveawe, interline, and intertwine and in the end just the right places are done perfectly and just the <i>other right places</i> are cobbled together just enough to keep the system together.<p>We occasionally do misses there, but good programmers have a pretty good hunch on which way to lean at which stage of development and which part of the code.
评论 #7185322 未加载
bad_user超过 11 年前
MVPs are great, however new business opportunities and new ideas will always come up on a monthly basis, at least.<p>Especially in startups, you never have time to take care of technical debt. In practice, technical debt is dealt with &quot;on the side&quot; and teams that don&#x27;t do it will end up in situations in which simple features or pivots are extremely hard to execute, which will lead to lost business opportunities. I was at some point in this situation due to a minor pivot that should have been painless but wasn&#x27;t, with the solution chosen being to rebuild the product from scratch. This is why I&#x27;ve been telling my colleagues to always leave the codebase in a better state every day, even if that means just renaming a variable. Sloppy code also suffers from the broken-window effect.<p>What you really want is to write elegant code that works and that&#x27;s delivered on time. And the greatest trait of a senior developer is not &quot;cutting corners&quot; but rather simplifying the problem. That&#x27;s not the same thing, as the simplification of a problem often leads to more initial work.
gesman超过 11 年前
I&#x27;d add more controversy here: if deadline is unrealistic it is ok to miss it and do things the right way.<p>Deploying ugly piece of shortcut that is going to give you grief for the next 5 years is not worth making for the sake of pulling your skin off to met unrealistic deadline that was created by the layer of clueless management.<p>Follow your professional intuition of course.
评论 #7185436 未加载
shill超过 11 年前
Fast, good and cheap. Pick two. The author&#x27;s projects require more <i>fast</i> and <i>cheap</i> than <i>good</i> to be successful. Other projects will have different requirements.
volaski超过 11 年前
Your code may f * * * ing work, but my server f * * * ing loads
评论 #7185356 未加载
dasil003超过 11 年前
His code may be elegant, yours may f<i></i>*ing work, but mine works without the profanity.
nchaud超过 11 年前
After 7+ years of intense coding during my work and often evenings&#x2F;weekends across many languages, a few months ago I came to the conclusion<p>&quot;The ability to make those decisions (of where to cut corners), often mid-project, is what separates veterans from rookies.&quot;<p>I don&#x27;t have the kahonas to call myself a veteran but certainly, I can now relate to this. I shall be keeping this article to forward to colleagues at appropriate times in the future, along with Joel@FogCreek&#x27;s article on why re-writing software with the same guys, the same skills and a simplistic - albeit optimistic - mindset is suicide for your application&#x2F;service&#x2F;software.
aaronbasssett超过 11 年前
They have a CEO, a CAO and a VP of business development but nowhere on their about us page does it list a CTO or ANY senior level &quot;engineer&quot;. And this is why their company doesn&#x27;t value doing development right.
评论 #7185789 未加载
评论 #7185912 未加载
bbwharris超过 11 年前
Hey it&#x27;s not popular here, but I agree with this sentiment. The key is knowing when and where to make sacrifices. I don&#x27;t believe in technical debt. I&#x27;ve seen huge codebases with many lurking dragons. Those dragons solved real problems, and made the business enough money to employ engineers who are supposed to be smart enough to work through it.<p>Real code that &quot;you&quot; didn&#x27;t write is messy. It takes a long time to understand the history and context of any sizeable codebase. Perhaps that legacy feature is there to serve one customer, but it&#x27;s an important customer who is about to upgrade to a more comprehensive plan. Perhaps that 100 line function is the only way to really handle some arcane API without muddying up the rest of the &quot;better designed&quot; parts.<p>Code you don&#x27;t write is the hardest code to maintain, whether it&#x27;s elegant or not. Code solves business problems, so without understanding the business or the specific problem it&#x27;s trying to solve, you are not educated enough to make a snap judgement about it&#x27;s &quot;design&quot; or &quot;technical debt&quot;.<p>I say it all the time, code is not cement. It can be changed. Good engineers find the constraints, change the parts that are hard to understand and maintain, and keep everything up and running.<p>There is no &quot;right way&quot;, or magic set of patterns that are going to save you from the realities of a user facing product.
memracom超过 11 年前
You danced around one important point about technical debt. True professionals do not avoid technical debt, but they do account for it. That means that when we take shortcuts we should be aware of what kind and amount of technical debt we are incurring, and we should track it, probably in a similar way to tracking bugs. Then, the stakeholders of the project can look through the technical debt and prioritise which items that they want to fix and when.<p>The bad thing about our industry is that too many people take shortcuts and don&#x27;t tell anybody about it or keep any records to assist in fixing the weaknesses that are introduced in the software. Sometimes this is malicious because a developer is trying to give the appearance of being a mythical 10x developer.<p>In fact, I believe that the vast majority of so-called 10x developers are actually frauds. Most people are unlikely to encounter such a developer outside of the blogosphere and conferences, unless you are fortunate enough to work for one of the big technology companies like Facebook, Amazon or Google, who have the resources to find the real McCoy.
mchanson超过 11 年前
This article reads like its written by someone trying to extrapolate some specific experiences of conflict on teams he worked into a general rule.<p>I would recommend keeping an open mind and looking for programmers to work with that are able to teach you and that you collaborate well with.<p>If you find yourself being self-righteous too often when coming home from the job (or on the job) its time to find new folks to work with.
frou_dh超过 11 年前
A bit sad that the piece doesn&#x27;t even acknowledge that not all code is written for &quot;business&quot; or client purposes.
rglover超过 11 年前
Another point to add to this: the majority of what we do is ephemeral. I battled with this idea for a long time (even being 100% adverse to what this article says at one point), but ultimately I learned to accept the fact that code on the web is temporary and ultimately subject to change.<p>A quote by Ethan Marcotte (the guy behind responsive web design) sums it up nicely for me: &quot;Designing for the web is like building sand sculptures.&quot;<p>Yes, there are certain situations where you should double-down on engineering, but it&#x27;s wise to see if what you&#x27;re building will even be around in a few months. Not to mention, a lot of the code I write is obsolete by the time it ships (either by virtue of my skills improving or the framework&#x2F;language I&#x27;m using upgrading). A guy I have in my Skype list has the most foretelling status: &quot;you&#x27;re writing legacy code.&quot;
JeremyMorgan超过 11 年前
While I mostly agree with the article, it&#x27;s a bit short sighted. &quot;Building crap is ok as long as it&#x27;s done&quot;.<p>Whether you plan to stick around long term matters here. Are you just pumping some crap out at a 6 month contract and don&#x27;t want to hold up any sprints? This is a good approach. Are you working at some stepping stone type company where you don&#x27;t really care and are looking for something else?<p>If you&#x27;re at a company you love and you plan to be there a while, you really should make a more concerted effort to build better stuff. The shortcuts you take now will catch up with you later. Also Technical debt is a real thing.<p>Hacking it and &quot;Getting it done&quot; for some hyperactive project manager who doesn&#x27;t understand tech is fine and dandy for the short term, but if you stick around long enough you&#x27;ll pay for those sins.
pessimizer超过 11 年前
Your code may work, but only on your dev environment when the wind is blowing from the east.
maerF0x0超过 11 年前
Someone ask Target if they&#x27;d rather highend security w&#x2F; a missed deadline or insecure and on time...<p>The point: Context is king in this matter, it sounds like the OP doesnt work on things that really matter much (and hence the cost of a bug is miniscule)
ledneb超过 11 年前
I think the real sentiment is &quot;sometimes you just have to get things done&quot; (which I agree with) but I have a few issues. I tried to bake them in to something which wasn&#x27;t a bullet-point list, but perhaps this is just how my brain works...<p>1) Over-engineering is a separate discussion to elegance, let&#x27;s not mix them. 2) You can be both on-time and elegant - it&#x27;s not one or the other, like the title implies. 3) Often, if that fails, the deadline can be moved without any real consequence. 4) Consistent failure to be elegant &quot;because deadlines&quot; is probably going to make later deadlines harder to meet - it seems like a bad cycle to start.
dstefan超过 11 年前
I think that is the number one purpose to make software work but doesn&#x27;t have to entitle a programmer to do stupid things. The quote from Ralph Johnson states this:&quot;Before software can be reusable it first has to be usable.&quot;. In my mind, every real programmer likes to write pretty codes because after reaching higher levels trivial problems are so boring and writing flexible code kills two birds with one stone. Writing disposable code is another case. If you aren&#x27;t interested in programming and don&#x27;t enjoy it, you shouldn&#x27;t have to choose this profession.
hugofirth超过 11 年前
I actually liked the article much more than I was expecting to given its opening tone and provocative title.<p>There is definite truth in the fact that the decision to minimise (as far as is possible) technical debt accrued throughout a project&#x27;s journey to release should be carefully considered if the actual, &quot;real world&quot;, goal of the project is in some way time sensitive.<p>However I take issue with a number of statements made throughout the article; Namely:<p>- &quot;With that said, &quot;best practices,&quot; however you define it, should be a natural coding standard for any decent developer&quot;. In my experience this is simply not true. A lot of tried and tested best practices (SOLID etc...) are not necessarily intuitive at all. How would I, as an unexperienced programmer, have known that the &quot;new&quot; keyword is often a code smell, if someone had not told me?<p>- &quot;If the client needs a Christmas promotion, and you deliver the best product in the history of promotions -- on December 29th -- it&#x27;s worthless&quot;. This is true. It is also an exercise in reductio ad absurdum. The author chose an example with a hard deadline, which is unusual. Furthermore, to turn that example on its head:<p><pre><code> No Christmas promotion is due to arrive on Christmas day. It might, instead, be due to arrive on December 1st. If the outcome of releasing the promotion on time would be worse than if it was delayed by a week (i.e. The project had major technical flaws), then delaying by a week would be the correct decision. This is a decision that business men&#x2F;women should make in conjunction with engineers. Is a working promotion on the 7th of December worth more than a non-functional one on the 1st? Probably. </code></pre> Mostly, though, I agree with the idea that engineers should be conscious of the broader &quot;why&quot; &amp; &quot;when&quot; of their work, rather than just the &quot;what&quot; &amp; &quot;how&quot;. This is often achieved through communication, which should (IMO) be the true takeaway from articles such as this.<p>EDIT: Obviously being late on a project is never good. This is why contracts should have penalty clauses, which should be factored into the decision I discussed.
oinksoft超过 11 年前
<p><pre><code> &gt; If the client needs a Christmas promotion, and you &gt; deliver the best product in the history of promotions -- &gt; on December 29th -- it&#x27;s worthless. </code></pre> Isn&#x27;t the point to set a deadline that allows the product to be built to a certain standard of quality? If you only ever have time to write untested copy-paste &quot;code that fucking works&quot; then you don&#x27;t have a problem with your development approach ... <i>unless you&#x27;re convinced that&#x27;s the only way to do things</i>.
评论 #7185001 未加载
rpm33超过 11 年前
The higher order bit remains writing high quality code under pressure that works. High quality encompasses well tested, adherence to abstractions, maintainable and readable.
评论 #7187029 未加载
ziffusion超过 11 年前
First - it&#x27;s not about elegance. It&#x27;s really about organizing, arranging, structuring the code so that the brain can handle it efficiently (which in turn gives you the nice properties of maintainability etc.). As a side effect, the brain also perceives it as elegant.<p>Second - it is not one or the other. It needs to both work and be comprehensible. Delivering &quot;non-elegant&quot; code that works though, is job half done.
chris_wot超过 11 年前
Your code may be elegant, but mine works. Until it doesn&#x27;t. And then I spend hours and hours of time trying to find my bug because of my crappy code.
simondedalus超过 11 年前
similar to the concept of ockham&#x27;s razor.<p>many people with little familiarity or experience with actual philosophical work seem to believe the razor urges you:<p>&quot;the simplest explanation is more likely to be correct.&quot;<p>however, the razor actually says:<p>&quot;do not multiply entities beyond necessity.&quot;<p>the point here--and it&#x27;s not just for programming or logic--is that you can make your explanation as big&#x2F;small complex&#x2F;simple as you want, but if it&#x27;s <i>more complex than it needs to be to adequately explain what you&#x27;re talking about</i>, ockham says: cut it down.<p>if my theory has 1000 elements, your theory has 2, and we predict slightly different results to some experiment, <i>ockham has nothing at all to say to us</i>. ockham&#x27;s razor is only useful regarding predictively equivalent theories. if ockham were saying &quot;keep your predictions simple stupid,&quot; his razor would be trivially bad, and its implications trivially false.<p>similar to code: if it doesn&#x27;t work, its elegance is irrelevant. virtues like parsimony, elegance, or even scalability and the like are built on top of actually doing the job in the first place.<p>edit: p.s. people are attacking the article for its strawmen, or for being too simplistic re: speed vs quality. i don&#x27;t see how either of those get in the way of the author&#x27;s fundamental point: don&#x27;t overengineer, or mistake &quot;objective quality&quot; (???) with what&#x27;s called for in a project. if i&#x27;m buying a $100 laptop, i&#x27;m upset that it doesn&#x27;t have a haswell i7, but i&#x27;m not immediately wondering why the laptop&#x27;s processor is so bad because it doesn&#x27;t have an i7. ideas need to be kept straight.
killertypo超过 11 年前
Without seeing examples of what they consider &quot;fucking done&quot; and &quot;elegant&quot; it&#x27;s kind of a moot argument. Maybe they&#x27;re already writing decent code, or maybe their working on short term projects that just need to be finished and not long standing products that require years of maintenance and ease of upkeep at the added cost of complexity.
vitd超过 11 年前
This whole article reminds me of todays article from &quot;The Daily WTF&quot;:<p>&lt;<a href="http://thedailywtf.com/Articles/User-Rejection-Testing.aspx&gt;" rel="nofollow">http:&#x2F;&#x2F;thedailywtf.com&#x2F;Articles&#x2F;User-Rejection-Testing.aspx&gt;</a><p>&quot;There are only two options here: either you did your job and the application is correct, or you’re an incompetent and it’s wrong.&quot;
crazy1van超过 11 年前
Elegance is so subjective. Many developers seem to define it as making design decisions their way. Working is much less subjective.<p>In my opinion, it&#x27;s better to focus on improving what is measurable. That means focusing on making more things work than making things more elegant.<p>Of course, this whole debate is a broad generalization and the devil is in the details.
评论 #7186448 未加载
notacoward超过 11 年前
No it f<i></i>*ing doesn&#x27;t. Site down.
null_ptr超过 11 年前
Different projects call for different standards of quality. A Christmas promotion might as well be spaghetti code if that&#x27;s what it takes to get it out the door in time, but if you&#x27;re doing say an RTOS or a foundation library then you&#x27;d better take the time to do it the right way and respect the craft.
MaybiusStrip超过 11 年前
Mundane blog post about balancing code quality with business requirements with a click-bait title. Save your time.
pekk超过 11 年前
OK, I&#x27;ll bite. Your code may run today, but it will crash, screw things up and be hell to maintain tomorrow.
sm_sohan超过 11 年前
&quot;Your code may be elegant, but mine works&quot; - of course it works today, who cares about tomorrow?
PeterBarrett超过 11 年前
I wouldn&#x27;t call my code elegant if it didn&#x27;t do the intended job. Also there doesn&#x27;t need to be a compromise between being on time and having elegant code. With enough experience and planning you should be able to achieve both!
ForHackernews超过 11 年前
This used to be called Worse is Better. It&#x27;s not a new idea: <a href="http://dreamsongs.com/RiseOfWorseIsBetter.html" rel="nofollow">http:&#x2F;&#x2F;dreamsongs.com&#x2F;RiseOfWorseIsBetter.html</a>
kerkeslager超过 11 年前
All elegant code is working code.<p>Not all working code will be working in 5 years.
eklavya超过 11 年前
Over Engineering != Best Practices Optimizing only if needed != Cutting Corners but Bad Code == Bad Code (no justification for it)
pistle超过 11 年前
Not worthy - not worthy - not worthy. Link bait into troll... This should not be this high on my HN feed.
Akili超过 11 年前
&quot;Your code may be elegant, by mine f<i></i><i>ing works.&quot;<p>Really, prove it. Oh wait, writing tests is &#x27;over-engineering&#x27; and &quot;Best Practice&quot;, you don&#x27;t do that. Do you use WinZip every night rather than use an SCM? yes? your a f</i>*king idiot.
0xdeadbeefbabe超过 11 年前
Come on there is a difference between just f<i></i>* works and works.
评论 #7185602 未加载
piyush_soni超过 11 年前
How about a code which works and is elegant as well? Plan better.
niix超过 11 年前
That site is hideous.
hubertocarlos超过 11 年前
trolling. got to be.
ninjac0der超过 11 年前
... and as expected, it&#x27;s always the manager, not coding types that state this so aggressively. I know the servers are beefy at OmniTI, so I suspect there might be a code problem related to handling the load.<p>If I see sloppy code, or have to write sloppy code, I move to another company, and will continue to do so. So how&#x27;s that employee turnover rate (hint, use the internet archive and check the about us page)?
评论 #7185225 未加载
fleitz超过 11 年前
I hear these arguments all the time, fundamentally though as the author states, using best practices should get your code out the door quicker.<p>If best practices make your code take longer to develop then one has to question whether they are best practices at all.
jbeja超过 11 年前
Well to me is more a matter of pride as a developer, and the quality, readable and maintainable of my code make so much of it. If i am feeling that i writing sh<i></i><i></i>*ty code then my pride would be hurt at some degree :(.
crpatino超过 11 年前
... (as of today)