TweetFollow Us on Twitter

June 96 - The Veteran Neophyte: Manual Labor

The Veteran Neophyte: Manual Labor

JIM MENSCH

As a 14-year Apple veteran, why would I be writing a "neophyte" column? It's true that I've written system software for many Apple computers and I've been in every tech support capacity that Apple has ever dreamed of. I'm writing this because I'm in fact still wet behind the ears; I learn new things every day here at Apple. Most of what I learn involves problem solving and debugging. I believe that creative problem solving is the one trait that separates a great programmer from an average programmer. Great programmers must hone their problem-solving skills all the time, whether at a computer or not. In fact, sometimes examining how day-to-day problems are solved can help us develop proper coding and debugging skills at work. Here I'd like to relate a little fable to illustrate this point (the names have been changed to protect my automotive pride).

A FABLE

Bob and Stu were working on a primo 1963 Dodge Dart that they had just bought. It was a classic: push-button transmission, cherry upholstery, straight body. A classic car with a classic problem: it had been run dry of oil and the engine needed to be rebuilt. Flush with confidence (having just completed an engine rebuilding course at the local community college), Bob said, "No problem, man. Let's rebuild it ourselves; how hard can it be?" That, I suppose, was the first mistake.

So, Bob and Stu set out to rebuild the engine, using all new parts. A scant two months later, the ten-hour job was finished. Finally they were ready to install the engine. Struggling to get the 1000-pound engine into the car and onto two very small bolts that hold it at an angle too obtuse to allow it to drop in straight, they were cussing and cutting themselves constantly.

After a while it dawned on them that things were not going as planned. In a moment of brilliance, Stu said, "Hey, what does the manual say about installing this thing?" The manual! Every good car mechanic has a manual and follows it. Why didn't I -- er, Bob -- think of that? Reading the manual, they found that the torque converter (a big heavy round thing with teeth on it) was supposed to be mounted not to the engine but to the transmission!

They pulled out the engine and struggled for an hour to get the converter mounted to the transmission. After this the engine went in relatively easily (with the help of Thom the helpful Brit). Having connected all the hoses, belts, doodads, and whatnots, our intrepid pair looked at each other with giddy anticipation. "Could it be that we're ready to start this thing?" they wondered. So they tried to start it -- and they failed to start it. Just as with every major programming project, they had put in countless hours, and when the time came to fire the baby up, nothing happened.

It was time to debug this problem. "Hmm. Seems like a compression problem. Do we have compression?" asked Stu. "Yup, it's low, about 60%, but I guess that's because the engine hasn't been broken in yet," replied Bob. Were the plugs firing? Ground one side, turn out the lights, look for the blue spark: of course they were firing. Was the gas getting to the carburetor? Not yet, so they siphoned some up and tried again. Still no go.

So they started looking at the esoteric stuff. Was the timing chain on correctly? Well, we have compression, and it seems that we shouldn't if the timing is wrong. Three hours later, after Bob browbeat Stu into agreeing that the timing must be correct, Stu browbeat Bob into testing it anyway, since while Bob talked a good game it was always possible that he was wrong. They partly disassembled the engine and watched the little valve bits go up and down, and sure enough the timing was right. A victory for Bob, hollow as it may have been.

They continued to argue about what the problem could be, and finally decided to let it rest a while. This went on for weeks, until one day Bob remembered something that his teacher told him in class: a tablespoon of oil in every cylinder will get the seals sealing so that an engine could start. Could it be that easy? Could it be that the first thing that they had looked at -- the compression -- was in fact what was preventing the engine from starting? Bob put a little oil in each spark plug hole and the mighty engine roared to life! Our heroes stood dumbfounded at first, then quietly patted themselves on the back for such a fine job. Months after they had started their odyssey, they finally got the beast running.

YOU'RE NEVER TOO SMART TO READ THE MANUAL

The first thing to notice is that reading the manual was not the first step Bob and Stu took toward solving their problem. Neglecting to read the manual cost them hours of avoidable frustration and rework. Like Inside Macintosh, automotive manuals contain many hidden gems that are there for the asking. For instance, the shop manual didn't explicitly say, "Don't be a moron; the torque converter stays attached to the transmission!" but it did say, "Step 9. Remove torque flex plate screws, leaving converter attached to transmission."

Inside Macintosh contains many such tidbits waiting to be found. For instance, I was recently asked by a developer why a particular call to close a window wasn't causing the window behind it to redraw properly (it was leaving a desktop-patterned hole behind). Examining the problem a little further, we found that a resource that was needed had been purged and wasn't being reloaded. The code was smart enough not to crash when the purged resource was discovered, but it didn't seem to be able to reload the thing. As it turns out, the developer was using a rather strange strategy for manipulating the ResLoad attribute of the Resource Manager. He was turning it off when he wanted it off but not turning it back on again right away; instead he would turn it back on when he needed it on. I pointed out to the him that this was the problem, and he said, "I've been programming the Mac for almost 10 years and I've never read anywhere that the Window Manager assumes ResLoad is TRUE!"

While he's right about this on the surface, if we look we find that Inside Macintosh warns in the SetResLoad description that "If you call SetResLoad with the load parameter set to FALSE, be sure to . . . set [it] to TRUE as soon as possible. Other parts of system software that call the Resource Manager expect this value to be TRUE." (This has been in there so long that Caroline Rose wrote the first draft of it!) Since the WDEF is system software, it assumed that ResLoad would in fact be TRUE. After I pointed this out, the developer decided it was time to break out those manuals that had been collecting dust for so many years, and revisit some of the documentation he thought he had remembered.

YOUR FIRST INSTINCT IS USUALLY THE BEST

Another lesson to learn is that when problems arise, don't spend hours plodding through esoteric logic. First think, "What's the most obvious cause of this problem?" You might recall that Stu was right when he suspected a compression problem. By discarding the obvious without first examining it fully, we risk costing ourselves days of work only to find out that we were right all along. As a seasoned programmer, you'll learn that you can get a feel for why a problem exists. You may not have any ready logic to explain why an event occurred, but you might have a feeling anyway. Go with that feeling. The obvious things are the easiest to check (but don't make it too easy and stare past the real trouble). They're also usually the quickest to fix. Looking there first can save time, effort, aggravation, and lots of cussing. In my 14 years of problem solving for Apple, I've found that the simple, obvious solution is right 90% of the time.

CONFIRM YOUR LOGIC WITH REAL EXAMPLES

Why did Bob and Stu retest the timing, anyway? Experienced troubleshooters, they realized that simply arguing about a point may lead to a conclusion, but any conclusion that can be tested should be. Logic dictates that the cam shaft can be 180deg. out of phase (for every rotation of the cam shaft, the crankshaft rotates twice and thus will be in the same position at 0deg. cam rotation as 180deg. cam rotation), but you should check it anyway if you're stuck. It's easy to get your logical conclusions backwards and get your crankshaft 180deg. out of phase. On a car this might result in outright failure, while on a computer it can mean more insidious things.

I recently needed to use the Power Manager to control screen dimming, drive spindown, and CPU sleep. All of the calls had a "get" function that returned a Boolean, TRUE if the feature was on or FALSE if it was off. Strangely enough, two of the "set" calls required a value of TRUE to enable the feature but one required TRUE to disable the feature. I spent hours looking at the complex logic of IF statements before I simply watched it all go by in MacsBug and noticed that I was sending a TRUE value to a call named Disable. Going back through my logic again brought the error right out.

BACK TO WORK

If you've learned anything from the above tale, good. Remember, manuals contain quite a lot of information and they're a good place to start. Also remember that this isn't rocket (or automotive) science. Think simple thoughts; don't create extra work for yourself.

JIM MENSCH (mensch@applelink.apple.com, AppleLink MENSCH) has spent the last 14 years as a wage slave at Apple. Before that he did real work that involved cleaning and lifting and toting stuff and working with tools. While his mother is his real inspiration in life, he looks to the relaxed masses for guidance. An avid book collector and cook, he has absolutely no time for computers when he's not at work. His personal motto is "Eat more beets."*

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.