I completely agree with these statements, but what I struggle with in
my work is with what my fellow developers consider complex/simple and
readable/unreadable.
I work with a couple of guys who are very very smart, but they come
from strong procedural backgrounds so they actually find huge methods
with deeply nested ifs easier to understand than a modular more OO
solution. Whenever they Ctrl-Click on a method and end up in an
interface, they deem that unreadable and hard to follow. They find
switch/case easier to read than command pattern.
How do you bring craftsmanship values to a team that either can not or
will not make the effort to grok OO and make that next leap?
--
Curtis Cooley
curtis...@gmail.com
===============
Once a programmer had a problem. He thought he could solve it with a
regular expression. Now he has two problems.
> I work with a couple of guys who are very very smart, but they come
> from strong procedural backgrounds so they actually find huge methods
> with deeply nested ifs easier to understand than a modular more OO
> solution. Whenever they Ctrl-Click on a method and end up in an
> interface, they deem that unreadable and hard to follow. They find
> switch/case easier to read than command pattern.
>
More modular doesn't mean "oo". A well-modularized non-OO
is still cleaner than a deep stack of if-then-else.
Have them try to write tests for a single aspect of a big method
with specific circumstances, and then see if it looks all that simple.
> How do you bring craftsmanship values to a team that either can not or
> will not make the effort to grok OO and make that next leap?
>
>
OO has nothing to do with it. If you drag in baggage, you might
lose them. Testability is more important.
That having been said, OO is more testable IME than non-OO
due to ability to create test doubles.
Maybe the ability to test is a better handle? But if they don't want
to test, I don't know what you can do right now.
I think that the pain of testing ugly code is a pretty good spur toward
writing clean code.
We test. We test a lot. The problem is these are rollupyoursleeves
shouldertothegrindstone guys. If its hard to test, they just work
harder to test it.
I'm not sure, but I think there is another category of 'Joe' that
we've missed. The 'Joe' that shows up to work and works hard, all day,
then goes home feeling good 'cause he worked hard that day. It doesn't
matter whether he worked hard fixing yesterday's bugs or implementing
today's features. he worked hard, dammit, and that's what matters.
that sounds like a good point!
an a related example/anecdote: i believe there are Joes and Joettes
who write Bad Code in fact because they are Quite Smart at least in
the sense of having Really Good Memories. like, they are able to
comprehend the Rube Goldberg machine that is before them in a 4000
line file with 200 line functions in an overall wildly gyrating
system. if something bad happens, if there is a bug, rather than
figuring out a refactored simplified version, they instead patch the
daylights out of the code with more conditionals.
these people aren't dumb. they are too 'smart' in some sense, i think. :-)
sincerely.
That's exactly what I've witnessed. Another indicator is that these
Joes can comprehend any huge method/class but the context switch of
opening another file is too much. Which is why they like putting all
the code in one class/method. They can scroll up and down a class and
not lose focus, but if they have to switch to another file, or worse
another interface, they've lost everything they were keeping in their
head.
Like there's an infinite sized one file buffer in their heads.
Arbitrarily long files are stored with no problem, but to load another
file, the current file has to be deleted.
So, perhaps teaching them some index card tricks, like CRC perhaps, so
they don't have to keep the model in their head? I'll try this next
time I pair. Just do some CRC as we browse the code so the model is on
the table in front of us and does not have to be kept in our heads. I
know that would help me a lot.
Maybe the pain of listing 54 responsibilities on one card might help as well ;)
One thing I forgot to mention, an important lesson for us all, I feel:
We should be careful about what we define as good/bad or un/acceptable
approaches and ways to think about things. We need to know what things
really are problems vs. what things are subjective and should be left
to personal choice + should be aided via tooling. I for one do not
wish to live in a One Way To Do It world, that seems really lame when
in theory computers could be put to use to help us make things be more
inclusive.
As a vaguely concrete example, consider the question of One Big File
vs. Lots of Little Files. I think it is pretty safe to say that both
approaches have their pros and cons. I believe that a problem we have
is that our tools force us to choose one or the other, we can't
currently have it both ways. That means we have to pick the least of
two evils, in some sense. If we had tools which could e.g. flip
between different "perspectives" on the code, we could support not
only people who habitually prefer one way, but we could allow each
person to try different modes, which can come in really handy at
different times.
sincerely.
I do most my paid work on OO systems and consider myself quite
capable at it but I find theese lines highly insulting.
I've signed the manifesto, maybe missed the fine-print though, and
didn't see anything saying that OO was required for something to be
craftmanship worthy.
Personally I find it highly disturbing that much of the discussion
presently focuses on two things, OO as "the only way that could
possibly work" and "TDD is the only way to responsibly develop
software". Now, Im a huge fan of TDD practiced right and I consider OO
to be a highly successfull, wildly usefull way to build software, but
aren't we being a tad dogmatic? Procedural code can be modular, easy
to read and understandabl, functional programing can be succint,
clear, fast and downright beautiful. I consider having GUT's (Good
Unit Tests) better than simply using watared down "test first, forgot
the design" TDD.
As craftsmen don't we ove it to ourself, our peers and the greater
community to be open to diffrent ways, approaches and solutions? Isn't
that the whole point?
Now, if their code is completly untestable and doesn't harmonize with
the rest of the system, now that's an issue.
That said, I never meant to say OO is the only way to be a craftsman.
I admit that maybe it sounded that way, and I apologize if it did. I
guess I was using a shortcut for "code that is completely untestable
and doesn't harmonize with the rest of the system." The rest of the
system is OO.
Your point is taken. I was mentored in craftsmanship by master's
fluent in OO, so I see good code as conforming to the SOLID principles
and crappy code as not. I'm admittedly biased towards OO, though I'm
always open to new and better ways. You are correct in that the
"movement" should be as well.
mod parent up!
OO as "the only way that could
possibly work" and "TDD is the only way to responsibly develop
software".
I actually worry now that - probably unintentionally - the message
getting out there is that "software craftsmanship = XP done properly".
I'm an XP practitioner, and coach in practices like TDD and
refactoring and OO design, but my career goes back long enough to a
time when I worked on teams delivering very high quality software
using some very different techniques, so I know as a personal reality
that "software craftsmanship" is a much broader church.
Here is my principle:As an aspiring craftsman, I don't ship untested code. Everything I write has a test to prove it works.Here is the difference:I use TDD to insure I hold true to this principle (as well as for other reasons). But if someone doesn't use TDD, but another technique insuring their test coverage, I would say that person is still a craftsman. However, the value is that the tests MUST be there to prove your system works. I have found this not to be best practice, but the medical equivalent of washing your hands. My code will get infections without tests.
1. You are not allowed to write any production code unless it is to
make a failing unit test pass.
2. You are not allowed to write any more of a unit test than is
sufficient to fail; and compilation failures are failures.
3. You are not allowed to write any more production code than is
sufficient to pass the one failing unit test.
At the risk of sounding snarky, works != craftmanship
right; saying that something is tested is not a straight-forward
guarantee that it is proven to work, for many reasons.
so i'd like to include something like: "as a Craftsman, I actually
know what my tests actually test, and what claims I can make based on
the results of those tests." (you can replace "test" with <tool> i
guess.)
sincerely.
+1 Like it
i still don't get it, it really seems to ignore reality, or just be
naive. "as intended" is way too general imho. for this over-arching
topic i think it should err more on the side of something like:
"I appreciate the significant value of comprehensive testing but am
wary of its limits, and endeavour to find appropriate balance in use
thereof."
sincerely.
that is better, in my view -- an issue i'm having here is semantics
and connotation. it bugs me when somebody says only "tests prove it
works" because that is logically bull-pucky for any system of
reasonable size.
when it is more clearly stated as you have here, then i'm not so
freaked out about it. :-) so i would encourage people to find a way of
saying what you said here w/out leaving out the crucial details like
"as the tests specify" and "it doesn't prove your application works".
sincerely.
I think intended is a bit vague, but I like the idea. I would only
suggest something indicating a craftsmen's intentions are contentious
and well thought out.
How about:
As an aspiring craftsman, I can prove everything works as thoroughly
specified.
Right, but what happens when it's not thoroughly specified? Sometimes
what's intended is actually vague, and sometimes that's OK, and you're
writing the code that's necessary to get feedback about the customer's
intentions for the feature.
imho i think this kind of approach is not going to work (for me at
least :-). i mean, come on, do you really think things are ever
thoroughly specified? i don't even know what on earth that means, or
how you'd prove the condition was met.
i'm not saying there aren't goals to shoot for, but i think the way
people are talking about them sounds way too pie in the sky /
unrealistic, which i think is a very fundamental problem with the
entire software culture. you've got Joe Crap Code on the one side and
Frank I Claim My Tests Prove It All Works -- Oh Wait, I Didn't Really
Understand That User Story Nuance Now That You Mention It.
sincerely,
-the extreme curmudgeon here, apologies.
I'd suggest removing the implementation from the principle. "As an aspiring craftsman, I can prove everything I write works as intended."
it is interesting to me to see such a gulf between my reaction to
these, vs. responses from other people. i can hope it is a matter of
semantics -- that we all agree really and i'm just getting confused by
how things are phrased (but even in that case it is important to worry
about how it communicates to other people!), but i'm really worried
that somehow people think that they can "prove everything I write
works as intended."
are there any full time real QA/Test people who can weigh in on this?
i'm assuming they would have experience which would make them a little
leery of such phrasings?
(it isn't that i'm trying to kill this stuff, i'm trying to get it
refined to something realistic and thus valuable.)
sincerely.
... we don't need zealots and fundamentalists in software. That ain't craftsmanship - that's the exact and total opposite. It's also unprofessional too if you want to split the two apart.
2009/3/13 Jason Gorman <goo...@parlezuml.com>
I don't necessarily agree that "craftsman" and "professional" mean the
same thing. But more importantly, in all mature professions,
professionals have lines they can't/won't cross, be it for ethical
reasons, for reasons of safety, and so on. A doctor might strongly
suggest you lose weight, for example, and explain the risks if you
don't. But if you're too overweight for an operation, the surgeons
won't operate. End of discussion! If the customer demands that the
architect leave out fire exits, the architect won't explain the risks
and then do as the customer says. If he did, he might be committing a
criminal offence.
Jas
Jason, I have similar worries about SC = TDD++. Software
Craftsmanship is really *not* prescriptive of practice, technique, or
process. Looking at the end goals of what a Craftsmen should achieve
is a great approach to defining our principles. While methods like XP
tell us *how* to achieve our end goals for a project, Software
Craftsmanship sets the *standard* for our end goals for both projects
and careers. The finest-grained end goal of Software Craftsmanship is
a high-quality software system, a long-lived application that the
craftsman will maintain. The larger-grained end goals of Software
Craftsmanship are multi-year apprenticeships that produce future
community leaders, relationships between customers and craftsmen that
span careers, and ultimately, people growing themselves into master
craftsmen over the course of decades.
So +1 to a focus on end goals.
Best,
Dave Hoover
//obtiva: Agility applied. Software delivered.
I like to refer back to Kent Beck's 4 rules for simple design. In
priority order, the code must:
1. Run all the tests
2. Contain no duplicate code
3. Express all the ideas the author wants to express
4. Minimize classes and methods
When those criteria are met, the code is likely good enough. Notice
that passing the tests and no duplication are the most important
criteria. You also have to realize that over time many small,
incremental refactorings will improve the overall design in a gradual
manner.
Now, back to the "industrial programmer". I'm willing to bet that most
if not all of them have never heard of Beck's rules. Furthermore, I'm
willing to bet that a majority of them don't even have automated tests,
so Rule #1 is impossible to start with!! That's part of the overall
education process that needs to take place. To be honest, I'd be much
happier raising the level of the industrial programmers, than trying to
create a relatively small group of craftsmen.
That's what will improve our industry as a whole, not some elite group
that knows better than everyone else.
--
Dave Rooney
Mayford Technologies
"Helping you become AGILE... to SURVIVE and THRIVE!"
http://www.mayford.ca
http://practicalagility.blogspot.com
Twitter: daverooneyca
Enrique Comba Riepenhausen wrote:
> 2009/3/12 Casey Charlton <ca...@goinsane.co.uk>:
>
>> At the risk of sounding like I'm in the wrong place... works > craftmanship
>>
>
> I must disagree with that for one simple reason (our first value in
> the manifesto):
>
> Not only working software, but also well-crafted software
>
>
>> If your priority is well written code, you almost certainly have a different
>> business goal from your employer. If you can achieve your business goals,
>> *and* have well written, maintainable, elegant, and just downright sexy code
>> too ... then all the better.
>>
>
> If someone is in the pursuit of what you just mention above, he/she
> would fall into the category of an 'industrial programer'.
>
> As most of us have mentioned before, there is nothing wrong about
> industrial programming, but I don't think that that is what we are
> looking for here...
>
> Cheers,
>
> Enrique
>
>
>> 2009/3/12 Curtis Cooley <curtis...@gmail.com>
This is exactly what we need to do, or we will never have these
principles. We've gotten a lot of input from a lot of people, but I
feel we are approaching the endless/needless refactoring phase and
risk not delivering the requested feature.
We need to do the simplest thing that could possibly work, release it,
then iterate over it. If we can come up with acceptance criteria
first, even better, but it's time to stop refactoring and release the
feature.
--
Curtis Cooley
curtis...@gmail.com
===============
Once a programmer had a problem. He thought he could solve it with a
regular expression. Now he has two problems.
We use the most powerful and reliable techniques we know , and continue
to look for better ways.
Works but is a piece of crap < Works with well-crafted code.
Let's just put that one to bed. There is no reason to trot out "mine is
better
that yours because it works" crap. As craftsmen, working is obviously the
goal. But that is too small a goal for us. We want it to obviously
work, and
work well, and survive ongoing maintenance and enhancement is good style.
Works is too small for craftsmen. We would like some adjectives and
adverbs on that.
If it's a matter of doing something we don't like much, a professional
does the job. We don't
have to have our heart fully in it. But it is clearly unprofessional to
ask anyone to compromise
their convictions and ethics.
Standards is the conversation we should be having. That's a negotiable
space.
I also agree that our industry is quite young, and I've said that quite
often. We probably weren't very good a building bridges 60-70 years
after we first started, although most of them "worked". ;)
Michael Wilson wrote:
> At the risk of being mind numbingly pedantic:
>
> Industry has indeed supplanted craftsmanship, but it has always been the
> product of craftsmanship. This is still an exceptionally young field.
> Let's not endeavor to skip the important bit.
>
--
In my mind a craftsman should strive to meet those rules. Keep the
principles in mind while delivering customer value. But sometimes it
is not that easy with a legacy application.
The problem I have is that I can't always factor out duplication or
change designs that should be changed. We as a company are not in a
position to test the entire set of applications we produce in an
automated way. I'm not saying we shouldn't be in that position. We are
heading slowly in that direction, but we are not there yet. Instead we
strategically figure out what needs to be changed and then
systematically implement.
Does this make us or anyone working on legacy software non-craftsmen?
--
David
blog: http://www.traceback.org
twitter: http://twitter.com/dstanek
furthermore, there's giving people fish, and teaching them how to fish
for themselves. if you don't fix the people + process that broke the
windows in the first place...
which can be an uphill battle, of course.
sincerely.
I disagree (with the wording, at least). I find that broken windows
>
> Too me at least this the key and perhaps the minimum.
>
> I would add perhaps: When broken windows are found a craftsman always fixes
> them (or at least starts to fix them).
are usualy happened upon on the way to something else. Some code bases
have so many broken windows that, if I were fix each and every one
upon first encounter, I would quickly find myself in the middle of a
huge refactoring effort and never be done with my original task.
Merely beginning to fixing is not enough. Half a fix is not a fix. An
improvement can in some cases be scaled down, but I'm wary to commit
code that is in the midst of a restructuring - say I forget to
complete the restructuring and leave it in pieces.