News for hackers. Stuff that matters.
Re:Perfection is a modern heresy by wellpast on Monday September 04, 2017 @03:51PM (#15170465)
This is straight from the cowboy coder's mouth. This is Philistinism, plain and simple.

> "...deliver something, anything...", no need to make it good, "teams make things better," anyway.

No, no, and no. If you want to scale a team you have to deliver quality code.

The cowboy coder spews out code, screams "see it works!", and then moves on to produce more diarrhea for "the team" behind him to clean up, "make better"...

When one realizes they do not yet have a skill (such as producing quality code), it is tempting to scream "quality/perfection is a heresy" because this is much, much easier to say than the labor it takes to develop the skill.

> It’s hard to see more than a week out because anything that takes more than a week to build involves R&D.

Wrong, wrong, and wrong. MOST of what we do as practitioners (for those that have been doing it for at least some time) is NOT novel. Estimation is a skill. Estimates can be extremely accurate for those of us that have developed that skill.

It is much easier to say "estimation is worthless" when it is a skill that you have not yet developed. Because it is only developed through (often frustrating) practice.

Record the time it takes to do your work. Notice the patterns of problems that you face and how often they repeat themselves.

---

Perfection per se has its hazards but in no way should that truth get us off the hook from developing ourselves and doing our work well.

This post is nothing but dangerous to the nascent programmer-practitioner as it attempts to lull them away from what is possible and the work it takes to get there.

Perfection is not attainable, but if we chase perfection we can catch excellence. -- Vince Lombardi

Re:Perfection is a modern heresy by mjw1007 on Monday September 04, 2017 @04:21PM (#15170626)
Some new programmers need the advice to spend longer improving their code before sharing it; some need the opposite advice.

Unfortunately, some people who dispense advice pick one of those "directions" and argue strongly for it, rather than trying to describe how to recognise when you've got the balance right.

Re:Perfection is a modern heresy by hashmal on Monday September 04, 2017 @04:50PM (#15170784)
Sadly a lot of people have a hard time understanding nuance and middle-grounds. In programming or in anything else.

If your code is to be thrown away in one week, why make it perfect? If you have to maintain it for years, why make it a pile of shit? Funnily enough you can't often predict the lifetime of code.

Re:Perfection is a modern heresy by jrochkind1 on Monday September 04, 2017 @06:49PM (#15171311)
This applies to _so much_ programming/architecture advice. Well said.
Re:Perfection is a modern heresy by Symmetry on Monday September 04, 2017 @06:49PM (#15171314)
An excellent essay exploring the implications of the point you made:

http://slatestarcodex.com/2013/06/09/all-debates-are-bravery...

Re:Perfection is a modern heresy by mmirate on Tuesday September 12, 2017 @11:31PM (#15235296)
> way more libertarian than can possibly be healthy

How is such a condition even possible? This seems to be equivalent to describing, say, a libc, as "way more bug-free than can possibly be healthy".

EDIT: there is no way that someone could be combing through days-old posts just to downvote something within an hour of being posted. >:|

Re:Perfection is a modern heresy by tetha on Monday September 04, 2017 @05:15PM (#15170898)
> The cowboy coder spews out code, screams "see it works!", and then moves on to produce more diarrhea for "the team" behind him to clean up, "make better"...

This resonates with me, and I hope I'm better than that. I don't know if I am. Some metrics might suggest so, but who knows.

Over the last couple of years, I've been working with a repeating pattern. Teammates have a problem, but the problem can be split into 20% - 40% hard / algorithmic / architectural issues, and something between 60% and 120% other detail-work once the hard parts and a couple of easy parts as examples are done.

So, I've grown to tackle and solve the hard parts, and give people a small chunk of software so they can solve their problem on their own, as long as I help them a little along the way. This is powerful if you have a strong understanding of the problem to solve, and a couple of open-minded team-mates. And it helps everyone to grow on a technical level, making further problems easy.

However, this requires care, communication, a strong understanding of the issue, support for the solution... By now, people ask me for to handle the hard parts, and I can just dump them a repository with a README and a rough solution. But that was a long way, and giving less support, less care to do the right thing, and doing less to build trust with the team will lead to a catastrophe. And interestingly enough - oversupporting would also lead to problems.

Re:Perfection is a modern heresy by ludston on Monday September 04, 2017 @07:09PM (#15171399)
This sounds like the inverse of cowboy coding. The classic cowboy move is to tackle all of the easy parts incohesively, so the end program does may three quarters of what it is supposed to. Unfortunately implementing the last quarter will usually require re-writing large parts of the original code over years.

Sometimes the cowboy will linger around to try keep the unshippable code as-is. :( I do not understand why.

Re:Perfection is a modern heresy by dsfyu404ed on Monday September 04, 2017 @07:09PM (#15171400)
If $( cat $your_code | grep '//' ) results in something that does a good job describing the code then you're doing a good job.

If you think you're documenting way too much then it's about right. The people picking up your source years after you've left the company will need that much documentation. Documentation also breeds more documentation. When someone goes in and changes something they're far more likely to document it if their change makes existing documentation/comments incorrect.

Re:Perfection is a modern heresy by taneq on Tuesday September 05, 2017 @03:30AM (#15173166)
That depends. I've found I actually comment/document less now than I used to in the past, because I'm better now at writing self-documenting code. If you can read the code itself and it reads like a comment, you don't need to write the comment.

I see both code and comments as a three-way conversation between myself, the person reading the code (who may be future-me or someone else), and the compiler.

Re:Perfection is a modern heresy by mikekchar on Monday September 04, 2017 @08:51PM (#15171782)
Programming languages aren't just used to tell a computer what to do. They are languages (albeit simple ones with limited expression available).

People who learn a second human language often fall back on a crutch known as "code switching". With code switching, when you don't know how to express something in the language you are learning, you switch back to your native language. This can often help people develop more fluency because they don't sit around concentrating on trying to find the correct term. They can say the parts that are difficult in their native language and then move on to the rest of the conversation.

However, code switching ultimately slows down your progress as a language learner. If you don't know how to express what you want with the correct grammar or vocabulary, it's usually better to try to find a different way to say it. By doing this you exercise your ability to be flexible in your speech. The code switcher tends to hit a ceiling very quickly and never becomes able to express themselves in the new language -- because they never have to. Finding alternate ways to express yourself is often frustrating, slow and embarrassing, but will help you in the long run.

Comments are like code switching. It's really helpful when you've written some code and you think, "I'm not sure that people will be able to understand what this means". It helps you get unstuck from your current position and to move on to the next thing, safe in the knowledge that you have expressed what you need to express.

However, you can also look at the situation differently. If you write comments, then you do not have to express yourself clearly in the programming language. It's easy to fall into the trap of thinking that it is unimportant to express yourself clearly because 1) you have comments (which are easy to write) 2) expressing yourself in code is hard 3) it will take a lot of time to learn how to do it well 4) you might fail and end up with difficult to read code.

These are all seemingly excellent reasons for writing comments, but they will also hold you back from being a better programmer IMHO. I prefer to avoid comments, using them as a technique of last resort. However, if someone says, "I don't understand your code" you have to take it pretty seriously and find a way to express yourself more clearly.

As a side note, this is one of those areas where reasonable people can differ. Of the issues that can cause conflict on a team, I find this to be one of the biggest. No matter what your personal opinion is, it's important to work as a team and do your best to please your teammates. Code is not for the writer -- it's for the reader.

Re:Perfection is a modern heresy by dsfyu404ed on Monday September 04, 2017 @10:03PM (#15172016)
You are not writing code for just you. There may be times when people fresh out of college who do not speak English as their primary language may need to understand your source.

There is often back-story that needs to be explained. Something as obvious as input sensitization may have a more specific meaning behind the specific implementation, for example a legacy Orcale DB client that chokes on certain special characters. A comment in a case like that can prevent you from getting woken up at 1am because a well meaning attempt to apply the same naming rules to schemas as you do to everything broke things.

If someone says they "don't understand your code" then either they suck at understanding code, you suck at writing it or both.

Comments are a tool to increase the speed and accuracy with which someone else can understand your code.

Re:Perfection is a modern heresy by btschaegg on Tuesday September 05, 2017 @12:31AM (#15172539)
I don't really think this goes against what mikekchar said, though. Take your own example (the legacy oracle client):

The code you're using to escape those specific characters should ideally be written in such a way that its intent is obvious even to a novice reading it. For the novice, then, the question shifts from "WTF does this do?" to "why is this here?", which would be a great example what to actually write comments for: context.

Imagine you're writing some very math-heavy library. Ideally, I shouldn't be a language expert to be able to see what your code does. This still doesn't help me if I don't understand the underlying math, however. Even hints like "this operation is called XY and can be used to Z" may be very helpful if someone wants to get a hold of what it does. With that, you can look up literature for this specific part.

Re:Perfection is a modern heresy by mikekchar on Tuesday September 05, 2017 @01:58AM (#15172831)
Yep. I don't disagree with either of you. I was really responding to the comment that your comments should form a kind of running commentary of the code (something which I completely bought into when I was younger, but then moved away from). There are certain things you can't express with code. I don't want to suggest that you stubbornly refuse to express it at all in those cases :-). It's just that it's a technique of last resort, not a technique of first resort (if that makes any sense).
Re:Perfection is a modern heresy by injectJon on Monday September 04, 2017 @11:04PM (#15172224)
With respect to code documentation, I am self-taught, and use thorough documentation because I feel it both reinforces my intent and gives me the experience of describing it to someone else. I get the benefits of teaching, while also sparing my S.O. hours of listening to me rant and rave about things she isn't interested in.

I dont have a mentor, so this has helped tremendously.

Re:Perfection is a modern heresy by mikekchar on Tuesday September 05, 2017 @02:01AM (#15172840)
This is a good idea. One thing you might try is also to do the same thing with unit tests. Can someone discover the intent of the code from the tests? I have found this considerably trickier to do than it seems because there is a tendency to introduce a lot of noise with the tests in order to get good coverage. I personally found it illuminating to refactor the code and tests so that I get the same kind of coverage without the noise.
Re:Perfection is a modern heresy by graysonk on Monday September 04, 2017 @07:24PM (#15171462)
You don't need the cat pipe. Just grep on the filename

But I agree entirely. I go back to things I did even a year ago and desperately wish I had documented more.

Re:Perfection is a modern heresy by btschaegg on Tuesday September 05, 2017 @12:36AM (#15172567)
I see that "useless use of cat" awards haven't died out yet.

Now I'm left wondering if that makes a point for or against the OP's arguments. ;-)

Re:Perfection is a modern heresy by dsfyu404ed on Tuesday September 05, 2017 @06:34AM (#15173892)
As a side effect of my 9-5 job I think of everything in terms of inputs and outputs that get piped into things and get piped places.
Re:Perfection is a modern heresy by jogjayr on Monday September 04, 2017 @04:41PM (#15170735)
Trying to attain perfection is good advice in a professional environment.

OTOH for side-projects, especially for people who have trouble finishing things without external motivation, it can be more useful to just get something done. Without the get-it-done mentality it's possible to obsess over the architecture, libraries, tech stack, deployment, test automation ad infinitum until you've lost enthusiasm for the project. It's great that you learned a lot of new tech but also slightly sad that the world will never see the idea you were so excited about 3 weeks ago.

Re:Perfection is a modern heresy by madiathomas on Tuesday September 05, 2017 @01:00AM (#15172650)
> Just get something done

This is the strategy that I prefer. I aim to deliver version 1 of my side projects within 3-4 weeks. After working on it for too long without delivering, I lose interest. I fix the time and budget of the version, not the scope. Unfinished features are cut out of the version 1. I focus on the core features. There will always be time to add extra features in the future.

Most people are afraid of launching because they don't want to be judged. That's why they delay the launch. I prefer giving my software to a handful of real users as soon as possible. So that they can test and give me feedback. There will always be bugs in software. Show me a popular software product and I will give you a list of over 10,000 bugs which were reported in its lifetime. What matters is the speed in which you fix them. If you created version 1 of the product, you wouldn't waste more than a day fixing all bugs reported on first day.

'Great artists ship' - Steve Jobs.

Re:Perfection is a modern heresy by 0xFACEFEED on Tuesday September 05, 2017 @11:56AM (#15176432)
This is a difficult topic to discuss because the "right" answer is very dependent on context.

Sometimes it makes sense to rapidly spew out brittle code. Other times it makes sense to delay until you get it right.

What's important is being in control of the situation. Know what you're doing and why. Know the tradeoffs and commit to them.

Re:Perfection is a modern heresy by hashkb on Monday September 04, 2017 @09:02PM (#15171825)
I think this post is aimed more generally than just at programmers. In my experience, I've found more perfectionism everywhere else in the business. Bias: I'm a programmer and I believe I take the time to do the job the best I can; most of my time is spent re-doing features that users have never used.