cwash into software

Tag: CapTech

Eliminate Branching (IF Statements) to Produce Better Code

by Chris Wash on Jan.07, 2010, under Developer Testing, Software Engineering

In a recent tech talk, I watched Miško Hevery propose an interesting challenge to his audience: start a toy project and try to write the code with no if-else or switch blocks at all. None at all?  Before thinking about how to do this, why would you want to do it in the first place?  On the surface, it may seem to the unassuming a bit counter-intuitive.  Comparison-based branching is at the heart of programming, and the concept of an if-else or switch block is almost universal, existing in most every programming language ever devised.  What’s Hevery’s agenda with this exercise – and what can possibly be gained from trying to write a program without branching entirely?

(continue reading…)

Leave a Comment :, , , , , more...

What I’d Tell Myself About Design If I Were Just Beginning

by Chris Wash on Jul.29, 2009, under Meta/Blog, Software Engineering

From all the time I’ve spent learning design, there are a handful of things I’d hope to remember or re-read if I were to ever get amnesia and have to start all over again.  For new comers and experts alike, I’d like to share a few ideas about design worth thinking about through musings and links to other material that has helped form my opinions (some more relevant than others).
(continue reading…)
5 Comments :, , , , more...

The Elements of Reusable Code

by Chris Wash on Jul.24, 2009, under Software Engineering

Back in April, there was an interesting article quoting Ron Jeffries et al on InfoQ looking at code reuse from an agile perspective. The conversation steered toward explaining reuse as a concern that is very expensive, looking at it from a top-down, “enterprise”-wide lens.

But is code reuse a black and white issue? My contention is there are varying degrees of reuse that are often neglected on a microscale within an even moderately-sized project. If the code you produce isn’t going to be reused, is it even going to be looked at? These are similar problems with similar solutions. (continue reading…)

Leave a Comment :, , , , , , , , more...

Mocking with JMockit

by Chris Wash on Jun.09, 2009, under Developer Testing, Java

Update: I cleaned up the example based on Rogerio’s comments.

Recently I stumbled onto JMockit and have been pretty impressed with the flexibility of the approach it takes.

Many mocking frameworks seem to take an elitist attitude toward testable code, not attempting to solve certain problems in favor of guiding one toward a more testable design. It appears JMockit is a response to this. (continue reading…)

5 Comments :, , , , , , , more...

What is Hamcrest?

by Chris Wash on Jun.03, 2009, under Developer Testing, Java, Software Engineering

As of JUnit 4.4, if you happen to peek into the distributed JAR you’ll notice something a little off: in addition to the org.junit.* packages there is this a funny-looking org.hamcrest.* package sticking out like a sore thumb. You may have seen other projects pick up a dependency on Hamcrest lately as well, and I bet you’re wondering what it is. Let’s get to the bottom of it. (continue reading…)

Leave a Comment :, , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...