Quantcast
Channel: XPlorations Archives - XP123
Browsing latest articles
Browse All 118 View Live

Organizing Fields and Methods

When you’re making a class, in what order do you put the fields and methods? We’ll look at several choices and some tradeoffs between them. Organizing Fields I’ve seen a few approaches to organizing...

View Article


Refactor: Inline-Adjust-Extract

Sometimes, we feel that something we extracted isn’t as good as it could be. The Inline-Adjust-Extract refactoring pattern can help fix that. It has three steps: Inline: put the extracted code back...

View Article


Image may be NSFW.
Clik here to view.

Time Troubles – Transitions

Time is a well-known source of trouble for programmers. We looked earlier at one type of time troubles: overflow. Today, I’d like to look at another time trouble: transitions. Here are the problems...

View Article

Image may be NSFW.
Clik here to view.

Threaded Code (and Composite)

Let’s look at the threaded code approach. It’s a less-well-known way to build an interpreter for a programming language. (The more common approach simulates each instruction.) Threaded code has a...

View Article

Image may be NSFW.
Clik here to view.

Pipelines – Confidence in Design

The other day, Kent Beck pointed out a skill that test-driven development (TDD) relies on but doesn’t give much guidance about: “behavioral composition”. This is the skill of dividing a big behavior...

View Article


Image may be NSFW.
Clik here to view.

Trees – Confidence in Design

Test-Driven Development (TDD) depends on assembling well-tested parts into a trustworthy whole. Some design structures make this easier. Today, we’ll look at trees. A tree is a structure consisting of...

View Article

TDD with a Function Pipeline

Our “geek” group tackled a problem a couple weeks ago, that one of us had heard suggested by Michael Feathers: given a sequence of numbers, tell how many non-zero runs it has. Ron Jeffries described a...

View Article

Image may be NSFW.
Clik here to view.

Swift Testing – A New Unit Testing Framework

Apple has introduced a new unit testing framework. It has a simpler syntax, much simpler assertions, parameterized testing, and more. Let’s take a look. You can find a bonus cheatsheet at the end of...

View Article


Image may be NSFW.
Clik here to view.

Run Tests Without an App — Step by Step with Xcode

I’m frustrated when unit tests run slowly. One way to speed them up in Xcode when developing using a simulator: isolate your model to a framework, and run your tests without a host application....

View Article


Image may be NSFW.
Clik here to view.

And-Or Trees

Suppose you want to represent a finite set of possibilities in a compact way. An And-Or Tree can do this, and is useful in several situations. An And-Or Tree has leaf nodes and interior nodes. The...

View Article
Browsing latest articles
Browse All 118 View Live