105 points · by narfz · 12y ago · 133 comments
And yet…
I remember programmers who disappeared for months at a time to work on "their" modules. Integration phases where we tried to combine wildly incompatible components after 6 months of separate work. The breathless joy of seeing an actual regression test suite for the first time. The endless arguments trying to find the ideal design. And we all thought this was the "right way" to develop software!
I remember Beck's Extreme Programming. For me, it came as a bolt from the sky, obviously radical and brilliant. It turned me from a clueless junior programmer into somebody who took over and turned around a 150,000 line, 14-year-old C++ project, a project which everybody thought had succumbed to terminal bit rot.
Unit tests. Short iterations. The planning game, a.k.a., "Here, let me take your list of features, and tell you what each one costs. Now you decide what order we build them in." Man, does it bring back memories.
Of course, that was pretty much the shining high point. Within just a few years, Beck's idiosyncratic personal vision had been replaced by the "agile manifesto", and then by an entire consulting industry. Good riddance to all that.
But you know, it's been a long time since I heard somebody say "integration phase" or "object-oriented analysis." And I couldn't be happier.
At the risk of sounding somewhat loony, I think Marx said something about the middle class (in his definition: the class between the proletariat engaging in production, and the ruling class of capitalists) trying to preserve the benefits it gets from its social role. Can't find a citation though.
https://www.marxists.org/archive/marx/works/1863/theories-su...
Also, in practice civil services are much more efficient in many situations than their market alternatives (possibly because they pretty much epitomise the proletariat you mentioned).
The criticisms about no metrics supporting the book assertions are valid too (we have more metrics now, though).
That said, a lot of things in this book are now considered good engineering practices, and the methodology guys have come back with a vengeance with the Agile/Scrum/Lean/Whatever waves that filled the blanks left by XP (and ensured a nice revenue stream for pure process consultants).
In four words you managed to perfectly encapsulate the problem I have with so much writing about development processes and tools.
It's not good enough to claim to be just incrementally better than what you're probably doing, you need to be the best most super awesome EXTREME thing ever!
The 1-star reviews roughly fall in three categories:
- This is not how proper projects are done.
- We don't need another cult-like methodology
- This will vindicate cow boy coders
2 and 3 may have a point.The real problem with cowboy coding is getting to version 2 (or maybe 1.1). But it should be stated that at least if you've got a successful version 1 you have most of a solid design to start with.
Interestingly, most development methodologies seem to be mainly concerned with getting to version 1 and not with producing a maintainable product or getting a successful but unmaintainable version 1 and evolving it into a maintainable version 3 (say).
The obvious exception is the Software Process Maturity Model or whatever the frack it's called today, which is enormously concerned with maintainability to the point of making initial development (or indeed almost anything outside of pure engineering environments) virtually impossible.
I lived in that world on a DoD program for 3 years. I still have nightmares.
We also had a customer who didn't want to "pay for the same code twice". That meant signal processing algorithm research had to be done in the operational real-time code, and that we could have one and only one codebase (including branches but not including engineer/scientist working copies). The "experts" from Mitre and elsewhere who were managing us were so clueless they didn't realize this was costing them more and adding more risk than allowing the scientists to do their algorithm development in Matlab and Fortran, then have the engineers turn the algorithms into an operational system. Of course, we still had to have requirements and design documentation up-front before we could implement code, so...
...was in fact a strawman. The whole horrible waterfall process was an urban legend: http://postagilist.wordpress.com/2012/06/13/the-perennial-wa...
Bullshit.
Source: I lived through it in the early and mid 1990s.
Not only are there projects where waterfall methodologies were applied, but they are sometimes (gasp!) appropriate.
In the majority of cases, iterative development of some sort is necessary, because the requirements keep changing. Waterfall simply doesn't allow for changing requirements, so it's hopeless in those cases.
But where requirements are stable, waterfall is a reasonable approach. Remember, it had its origins in the big iron days, when vast project teams analysed and replaced existing manual systems. For those projects, waterfall worked.
If you're writing the code for a space probe, or a missile, there's a limited opportunity to iterate once the item is deployed... requirements are stable, waterfall can be a rational choice.
And on moonless nights I still wake up screaming remembering a RUP project I was involved in around 2000.
"No true scotsman" and all, I know.
https://plus.google.com/+LaurentBossavit/posts/VBJTGru3PeW
Or this.
Which was a gross misinterpretation to this day. We still have naive PMPs running $100 million IT projects in the faux-Waterall style.
-----------------
This book advocates extreme coding. It's a disguised way to legitimize "dive-into-coding" with no proper analysis and design. This author advocates little if any comments, documentation etc. He actually states that "design is in the code" and documents get out of date and that's an excuse not to do it. How is that in comparison to the "traceability" principle advocated so strongly by Jacobson and Rumbaugh who believe that the final code should be traced back to the analysis documents (use cases in Jacobson book) He advocates programming in pair instead of code reviews! In short, this book gathers the industry "worst practices" exactly the opposite of OMT, OOSE, RUP etc.
I'm very much of the opinion that good code self documents, and excessive use of comments and documentation is a crutch for bad code.
Some optimised code might be really incomprehensible without commnets, but its the exception rather than the case. By far my biggest use of comments is to highlight inadequate or rushed code that should be revisited later (i.e. TODO: or HACK: rather than NOTE:).
Don't get me wrong - design and documentation is useful in practice as well as being the 'theoretical ideal' that I think should be striven towards. Diving in and making a mess to fix stuff or diverging from an original design is bad in theory - in practice it is a necessary evil with tight deadlines or when rescuing a project that is already in a seriously bad state - or even when the original design was naive or even impossible because it came from an inexperienced or otherwise inadequate source.
I'm very much of the opinion that you are very much of the wrong opinion.
"Good code self-documents" is a myth. Most programmers have trouble coming back and reading their own code, much less other programmers' codes. Comments and documentation written in spoken language ensure that the code can be understood much more quickly and efficiently and any misunderstandings are prevented.
Hogwash! maybe if you're writing assembly code or similar low level language, but one of the express benefits of high level languages like python, scala, ruby etc is that they read (to a competent developer) like english (or whatever your native tongue might be)
Maybe you and "most programmers" you know don't write decent code, but I can easily read others or my own code if its well written. The last thing I want is a bunch of comments everywhere. I am all for the occasional comment (as an exception) because my eye will be drawn to it, but in general, unless your code sucks, it should perfectly legible without the need for excessive comments and documentation.
Really? I was just poking through some code I wrote several years ago looking for something I may re-use and I didn't have any trouble figuring out the intention by reading the (largely) uncommented code.
Edit: Not project documentation, strictly code comments.
If only this were the case. Comments are frequently wrong- they were either wrong from the beginning, unhelpful, or never updated when code was changed. Whenever I find myself writing a comment, it is typically because I just wrote bad code. Sometimes, bad code is necessary; most of the time, its better to get rid of the comment and the bad code.
Ultimately, comments are not sufficient; you have to read the code anyway. Comments can only be useful in the regard of recording the intent of the author.
i know i'm fortunate to be very good at reading other people's code so my view is probably biased - its feedback i constantly get - i've never worked on a codebase where i can't contribute meaningfully on day one even when its of quite a poor quality. i've found myself explaining people's own code to themselves more than once too...
i've worked with lots of programmers and trawled through many code bases old and new... by far the easiest code for me to read is fairly devoid of comments with sensible variable names, lots of whitespace and descriptive function names and using procedural logic or sensible (not excessive) amounts of OO. hungarian notation i can take or leave...
comments don't hurt... documentation doesn't hurt, but more than once i've seen pretty disgusting code with a big comment above it explaining what it does where if they had just named variables properly and split the code into decent functions the comment would have been needless. a classic case is something which looks like:
void HandleProcessing()
{
/// ... insert 1000 lines of code
}which should be
void OptimiseMeshForRuntimeRendering()
{
RemoveDuplicateVertsFromVertexBuffer();
SplitIndexBuffersSoIndicesAre16Bits();
OptimiseIndexOrderingForCacheEffeciency();
PerformValidationChecks();
WriteOptimisedDataToDisk();
}that code requires zero comments or documentation imo it tells you what it does and how it does it... sure its a crude example i just conjured and there is some bad practice there if you take it literally (what data am I throwing around? there should be function parameters...), but i'm not afraid to say that if you struggle to read code like this then you are just not very smart. maybe the concepts (index buffer, cache) need explaining, but thats not what comments are for thats for Google, Wikipedia, hardware and library specifications and generally just knowing enough to be competent in your domain.
comments i like are this:
void OptimiseIndexOrderingForCacheEffeciency()
{
/// use the k-cache optimisation algorithm, this has been measured to work on test1.mesh only
// imagine code here...
}what i never want is a huge blob of comment explaining the algorithm and burying the fact that its effectiveness in this scenario has only been measured in a special case.
its shocking how many programmers are able to produce difficult to read 1000s of lines of code functions and forget the most basic principles of good, simple procedural programming, despite how familiar they may be with design patterns, OO or functional principles, CS theory, complexity bounds etc.
advice i constantly have to give and feel i never should: use functions. name them properly. use good variable names. don't write huge comments. refactoring is a lot quicker and easier than you imagine (and removes technical debt!). don't be afraid - source control will save you.
don't mistake the plethora of terrible programmers and lack of good example code for a sound principle being mythical...
EDIT: wtf is up with the formatting in this box? i see the help link now... but screw that i'm lazy
We obviously hear this quite a lot, but I think it's inaccurate - it's bad comments and documentation that are a problem, and comments in particular are often most prolific when they're bad. Comments and documentation often suffer from rot, in that they are not kept current with the code and end up being out of date in short order.
But the fact that comments and documentation can be out of date is a reason to do them better, rather than throw them away. I'm one of those people who typically codes "comment first" - writing a simplified english overview of the steps I expect to take, implementing each of them using real code, and taking a final pass to trim or expand comments as required. So I might start with:
function doit(){
// Load data from the input
// Get the correct records
// Search for the correct field
// Output the results
}
This is followed by implementation: function doit(){
// Load data from the input
records = Data.load()
// Get the correct records
records.uniquify(function(e) { return e.group_id })
// Search for the correct field
results = records.map(function(e) { return e.timestamp })
// Output the results
print(results)
}
We've now got stupid redundant comments of the type that cause problems. Rule of thumb for me is to decide if the statement in the comment can be trivially deduced from the code immediately following it. If it can, then the comment can go. If there's some additional assumption—perhaps about side effects or properties of data which might not be immediately obvious—then the comment can be expanded to include this information. So we might end up with something like the following: function doit(){
records = Data.load()
// Disambiguate records by looking at the group id - records will
// always be sorted by time, so we can do this to make sure we
// only get the first in a given group.
records.uniquify(function(e) { return e.group_id })
results = records.map(function(e) { return e.timestamp })
print(results)
}
Obviously not real code, but you get the point.In general, I find that working on "self-documenting" codebases is actually rather frustrating - especially when I'm coming in on a new project. There's an absolute load of implicit knowledge about software systems that's contained within the code, and while it should be exposed and made explicit wherever possible, it's sometimes not practical - meaning that "self-documenting" code often seems anything but.
function disambiguateRecordsByGroupID() {
recordsSortedByTime = Data.load()
results = recordsSortedByTime.map(function(record) { return record.timestamp })
print(results)
}Pair programming was THE most distasteful, unpleasant thing I have ever done in any employment. And I include in that my very first job which included cleaning grease traps and bathrooms at McDonalds.
If developers do not like pair programming, is it a problem with pair programming or is it a problem with developers, specifically their unconscious, machine-like it?
The whole point of XP is not only to go against management best practice but also against the comfortable habits of most software developers, in an effort to make them better developers.
I get some of it, because of war stories. But I know I'm missing a huge piece of it.
Like when did some of the older practices come about? Was it in the 90s? Late 90s? 80s? Are most of the reviewers curmudgeons that that watched the SDLC landscape change before their very eyes as their certifications lost value?
I directly saw this as I worked on the BS5750 standard and saw the rise and fall of TQM
I think you will find that in traditional engineering does stick closer to traditional project planning PERT/TQM and so on as its a lot more embarrassing and costly if a bridge falls down :-)
Its also a lot easier to do in manufacturing is easy you can measure the tolerances on a piston on an engine line and flag thats a defect or not - much harder to do in software.
- I doubt Lisp, Smalltalk, Forth, time sharing Basic and similar tools were invented for the waterfall model, and all were available in the '70s.
- Weinberger advocated egoless programming in 1971.
Also, looking back at the 1960-1975 timeframe, nobody would have accepted XP as a methodology. I can see the discussion "what do you mean by 'if it turns out we need more memory we simply move to a larger computer'? Ordering one will take months, it will cost us thousands of dollars a month, and we will have to build a new computer room. And no, it is not acceptable if that accounting program you are writing turns out to be a glorified checkbook because that is what you can cram into the machine."
Also, it wasn't as easy to get a MVP because there were so few libraries to build on. IBM would happily license you their 'database' software or their time sharing software, but you better be sure that you needed it, because you paid for it by the month. But it just wasn't possible to work on the idea "don't worry about the 3D graphics. We'll eventually pick a library, but that can wait."
A devil's advocate would argue that the XP book just was a good summary article with great marketing that due to pure luck appeared at just the right time.
So time wise something like UML and Unified Process actually occurred after XP and Scrum?
That kind of changes the timeline I had in my head about this. I almost feel like making something to figure out all of this.
And no, people didn't "just do their jobs." Management methodology isn't a new idea.
[1] http://en.wikipedia.org/wiki/Project_Management_Institute
Though tbh the same could be said of any of the mountains of methodology books we waded through in the 90s. The word 'evidence' appears precisely once in the RUP white paper, and it's not in reference to evidence for RUP itself being effective.
One of the criticisms I remember some people making of XP when it first came to prominence was that it shifted a lot of the hard work of software development onto the customer, or rather the customer representative; certainly, ever since I heard about what happened to the first XP customer representative (see http://www.coldewey.com/publikationen/conferences/oopsla2001...) I've taken comments about XP being a humane methodology with a pinch of salt.
http://blog.8thlight.com/uncle-bob/2013/12/10/Thankyou-Kent....
It was a bunch of practitioners sick of being told by MBA-types (or modelling "architects" that couldn't code) of the proper way to write software.
Almost everyone in modern software development has been impacted by XP, if you think through some of the practices that almost no one mainstream had heard of or were discussing in 1999 until XP:
- Customer is on the team (Often the biggest factor in IT projects)
- Test driven development (now BDD)
- Continuous integration (now Continuous delivery and Devops)
- Design improvement (refactoring)
- Small releases (now "Lean Startups")
- Planning game (or estimation without Gantt charts and WBS)
Detractors focus on the controversial practices like pair programming as if they were lunatic. Or on consultants making money flogging a crap methodology. I don't think consultants could make money on XP back in the day - it was too foreign and extreme.
Agile was born off the fumes of XP, to give people methodological freedom while agreeing to the same principles. This unfortunately enabled legions of consultants to invent their own whatever-the-hell method for their client and subject employees to it. But it also helped some teams to deliver faster and higher quality than they would have otherwise.
Have a look at http://en.wikipedia.org/wiki/Extreme_programming
Many of those principles and practices are followed by my team. They don't all suit every project, but many do.
Xp compared to the things that came before it, or to the things that came after it?
If you compare the opposite poles of Xp, and the things advocated in those 1-star reviews, the way that a lot of successful bushinesses develop software is a lot closer to XP than "pre-Xp" software methods.
It was a watershed for many. In fact, I would agree that the XP and TDD side of the argument won the intellectual debate.
With XP, sadly, this is true. Most times you bring up the XP practices individually, and they're "good ideas". You say XP, and they say "fuck pairing!"