Refactoring and Being Refactored

Before I go too far down the road with this blog, some basic terminology and concepts should probably be explained.

First offrefactorMenu, what is meant by “refactoring”? From Refactor.com: refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior. Its heart is a series of small behavior-preserving transformations.

Refactoring code isn’t the same as rewriting it, though eventually every line may be changed over time, with many added or better yet, removed. Every line of code in a system is a liability, a potential bug waiting to happen, so good code should be simple, clean, and clear. Whenever code starts to “stink” or becomes “spaghetti-ish”, it’s due for refactoring — especially if you were the developer who wrote it in the first place!

Refactoring is typically done in a series of many tiny steps — a property renamed here, a method signature simplified there. Good software development practices utilize unit tests or behavioral tests that automatically run whenever the code changes.a14e95a146b14a47300d8a9df5bdf4fb75d75c1e_large The process starts from a “green” condition in which all the tests pass before refactoring begins. If the tests break (the dreaded “red” condition) from refactoring, the code is modified until all the tests pass again. Sounds simple right? Usually it is, but sometimes it isn’t, especially in more complex systems involving thousands of tests and hundreds of classes. Sometimes tests are added or hardened to make sure the software is really doing what it should be doing.

Refactoring isn’t simply something that can be done whenever a good developer feels like it — it’s a necessity. Refactoring is something that MUST be done to keep the code-base maintainable and extensible. If there’s a feature or chunk of code that’s overly complicated, fragile, or that everyone’s simply terrified of touching, that’s a good indication that it should be refactored. It’s a discipline, an art, the craft of a master. You can always tell code that’s been refactored because it’s clear, concise, readable, and elegant. Good code to a developer is just like a good book is to librarian.

So what does that have to do with life or anything outside the “exciting” world of software development? Quite a lot, actually! God’s work in our lives looks remarkably similar to the refactoring process. When we become saved, He puts His Spirit inside us, and then sets about sanctifying — or refactoring — us.

Picture God looking over the “code” that comprises us on the inside and He sees something that stinks, a big ole mess of spaghetti-goo deep inside our souls. So being the Perfect Architect of our souls that He is, He sets out to fix it — and fix it right. He wants our code (our heart, character, soul) to be clean, clear, concise, and very readable.

How does He do that? How does He go about “refactoring” us? He allows or even orchestrates change and trials to come into our lives and then goes about the refactoring process. tornado_storm_on_highway-otherSometimes, He’ll add a test here or tweak something there and suddenly everything in our lives turns “red” and blows up, and we abruptly find ourselves facing trials and suffering. From our perspective, the world is falling apart and we’ll never get back to that wonderful “green” condition.

But is that really happening, or is it just God refactoring us? What if it’s just Him changing us little by little from the inside out, even though our outward appearance remains unchanged? A poor habit fixed here, a bad attitude corrected there. At times, He may even rip things up to make deep, significant changes.

Sometimes His refactoring of us can take quite a while, particularly when we’re stubborn, impatient, and stiff-necked. We won’t always see Him working and sometimes it feels like He isn’t doing much of anything at all. But He is! Time is one of those tools He uses best to mold, shape, and refactor us. He frequently uses time to soften what needs to be softened, harden what needs to be hardened, and knock those dozens of rough edges off. As the only one who can see the End from the Beginning, He knows precisely how to use time as His refactoring instrument.

So what are we to do while God’s refactoring us? Yield to Him. Follow Him. Walk with Him. Be faithful and hold fast to Him and His Word, potters_wheel_clay_sculpt_221395and let Him keep
doing whatever it is that He’s doing. He is the Potter and we are the clay (Isaiah 64:8). How are we to even know what the Divine Potter might be shaping us into?

Though it may be terribly painful and heartbreaking, raging against those failing tests or fighting against those difficult trials won’t make the refactoring process go any easier or faster — they’re just doing what He intends them to do. He means to build us up, not tear us down; to strengthen us, not weaken us; to purify us, not sully us. He means to refactor us into vessels that please Him.

Behold what manner of love the Father has bestowed on us, that we should be called children of God! Beloved, now we are children of God; and it has not yet been revealed what we shall be, but we know that when He is revealed, we shall be like Him, for we shall see Him as He is. And everyone who has this hope in Him purifies himself, just as He is pure. (1 John 3:1a,2-3)

Advertisement

About Chris Hambleton

Chris resides in Cape Canaveral, Florida, where he is employed as a software developer and consultant. He has authored more than a dozen books, as well as developed several websites, software applications, and written software-related articles. His other interests include traveling, hiking, running, studying the Bible, reading American history and politics, and literally devouring good fiction books.
This entry was posted in Christian-life, New Beginnings, Refactoring, Software and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s