Tag Archives: complexity

Functional agile: how does it work?

So I was thinking in the shower about how agile technical practices and functional programming both aim for something like “good” code, but then it occurs to me that — no surprise — “good” doesn’t tell me much.

I want to listen to what each “side” is excited about — not for “niceness” or for getting along or for unicorns and rainbows, but because I am all juiced about both, and I want to share that juice so I have more people to play with.

My first thoughts are that functional talks about correctness, and agile talks about utility. Functional programmers want clarity of vision, I think, with a precise understanding of the solutions they create, so they’re as simple as they can be, reusable and composable. And maybe agile developers are thinking about extensibility, maintainability, helping coders with stuff like staying focused, learning new stuff, avoiding getting buried in complexity.

I am guessing each would smile heartily at the things that motivate the other.

The thing that got me excited this morning was noticing that agile — even the technical practices — is about people. Pair programming, test-driven development, specification by example, and continuous integration are strategies for getting working, extensible, maintainable code, given that we are creative beings, going through life reaching for treasures without being able to predict the results of what we do. I call us mistake-makers; we poke at things and sometimes like what happens. We have brilliant days, and low energy or sad or un-brilliant days. We often don’t know what a solution will look like until it begins to take shape, and our solutions often involve learning, collaboration, discovery.

Here’e what I want to know: how do collaboration, discovery, emergence of solutions, and other agile values fit with functional programming? And as agile devs become fascinated with functional programming, what changes? Does this mean they leave their agile peeps behind? Or does the new functional stuff they’re discovering become part of their agile world?

Do loops add cyclomatic complexity?

I have been asking folks if loops add to cc. I think they’ve been telling me no pretty consistently, and I’m confused about that. I can see a Ruby  3.times do  wouldn’t add complexity. But doesn’t a java for loop contintually check whether the iterator is or isn’t bigger than some value? Why wouldn’t that count as a conditional?

Maybe none of this matters. Maybe if I take care of duplication, expressivness, responsibility, nobody cares. But dang it, I care. ^__^

GeePawHill sez…

Good lord, how am *I* supposed to know?

Actually, as far as I can tell, the loop itself inherently only creates one forking path extra. The path is identified by the condition while the loop is run vs. the condition when it is stops running.