Lot of talking about testing and Test-Driven Development today. Always fun and divisive!
Good 37 Signals article addressing the one-size-fits-all approach to TDD that pervades so many companies these days: http://37signals.com/svn/posts/3159-testing-like-the-tsa
Regarding David's comments, it's true that material really discussing what's worth testing and what's not worth testing is thin on the ground.
Testing is a broad science and pure TDD is hard. It isn't helped by being repeatedly told it's easy by people who want a flying-blind success guaranteed (no such thing exists!). While not perfect (and in Java), the GOOS book has been useful to me (also, for Rubyists, I'm putting the examples into Ruby here: https://github.com/seanhandley/goos-ruby).
For me, tests are most useful for working out the ins and outs of the problem space I'm in. Also, it gives me confidence to dive in and refactor other people's code when I don't know the whole project intimately.
The Raills-approach to writing specs for controllers, models, views and lib code with analgous test files in a spec directory tends to complicate the issue further. Finding tests for the file in question is easy enough with this approach but it leads to a mixup of integration, persistence and unit tests that take ages to run and end up with a sense of "just here for good measure" about them.
I find it helpful to consider that tests are just code. And code must solve the right problem in order to be useful. Learning to test well is learning to express your problem space in a replayable, shareable and easily understandable way. If we all used functional languages there'd be no need for the supporting codebase of a test suite because the "what" wouldn't need a "how". But this is real life, and we're not there yet... (boo)
As ever, software is about managing complexity carefully, getting regular feedback, being practical and remembering there is never One True Way.
Don't get me wrong. I'm all for affection and displaying it. Love is awesome.
But I get pissed off by florists, card-makers, chocolatiers and restaurants making millions by exploiting archaic traditions (bolstered largely by Americans filling their cultural void and the rest of the West following the moneymaking path). Putting an arbitrary date in the calendar where people are expected to show each other they care defeats the point - you shouldn't need reminding. And everyone doing it all at once on one day in a ritualistic way sets us up to be milked like the passive, docile, manipulatable commodity we have become.
I believe in love. And if you do too, this exploitation of people's fragility and need to love and be loved should make you very angry. Be a lover every day - not a sucker once a year.
So, this year I started running and taking fitness seriously. I ran, ran and ran some more. I did pushups and star jumps in the cold and rain. I pushed, pushed and pushed. And lost 2 stone in the process. I can now run a 10k without much trouble and I'm marathon training for next year. The gut has vanished and has been replaced with something you might believe was muscle.
But what on earth has any of this got to do with coding? Well, I'll tell you.
After sorting my health and fitness out, I have *bags* more energy than I did before. A year ago I lived on coffee and doughnuts and by the light of my screen I toiled away at code. And it was hard. I felt tired in the morning, I felt hungry all day and I felt tired in the afternoon. In a given day, I'd have maybe 4 hours of good coding time when my brain wasn't struggling to focus.
Compare that with last Tuesday when I worked a *thirteen hour* stint in the office - wide awake the whole time. And today I feel I could do the same again. This would never have happened last year.
What scares me is I didn't realise how poor my energy levels were back then and how badly it affected my quality of working. It's easy to adjust to a situation and regard it as normal. When you realise you can change that normality - it's a good day.
So, preachy moral time? A little, yeah.
I can't claim that being a runner automatically makes you a better dev. You still need to put in the screen hours, do the reading, write the code. But if you want to be a happier, more energetic developer - get outside and run. Do a Couch-2-5k, get Runkeeper app, join a fitness group or something. I promise it'll be worth it.
Why do people take Jeremy Clarkson seriously? I mean, really.
Clarkson is a middle-aged clown in a nice car. He's made a highly successful career in TV, radio and publishing by being a contentious, oafish prick. And, I'll be honest here, I think he's hilarious. The things he says are not witty, insightful or particularly imaginative but I don't want all the humour in my life to be delivered as rapier-sharp quips, dripping with intelligence and sophistication. Sometimes I want to watch a clown throw a pie. Maybe this is my failing, I don't know. It's this very attitude that sees me walk into a McDonald's occasionally. Sometimes I just want something base, uncomplicated and satisfying. Clarkson is that late night trip to Maccers.
The witch hunt surrounding him tells us far more about the people instigating it than it does about Clarkson himself. He says controversial things for a living and I have complete faith that he knows the reactions people will have and simply chooses not to care. If he were an elected official then I would understand why holding his tongue would be prudent but he isn't. He's a well-known public figure with a well-known (and predictable) persona and if he wants to (obviously!) make poor jokes about shooting people then why the fuck can't he?
Every statement of opinion will be divisive but I still want to hear it. I may not agree with what you say, sir, but I will defend to the death your right to say it. These humourless animals don't have the wit to understand Clarkson's implicit assertion when he makes these kind of remarks. That assertion is "you are an idiot if you take these remarks seriously". Anyone who can't see that assertion needs to re-examine their own perception of humour, subtlety and irony. Anyone who doesn't see that assertion should avoid me because I don't want to have anyone in my life who can only appreciate the world at face value, with all words understood literally. What dull conversation that would be. Spiritless, humourless, ball-less, soulless. This is not the humanity that I love.
Now, if you'll excuse me, I'm off to see the clowns.
In the last couple of years, Foxconn has seen ten worker suicides and three attempted suicides and the sweatshop/Western greed arguments have made it back into the media circle as hot topics.
As a fan of Apple product design (usability, reliability, simplicity etc) and someone who likes to think the world should pay attention to injustices and human rights scandals, this definitely caught my interest. I love the look of the new iPhone and am sure it will build well on what is already a fine lineage of the previous three generations in true Apple style. But do I want a device that's built on the extortion of people in poor and desperate conditions?
Let's consider the facts.
In the modern technological era we are in, the global economy is heavily dependent on being able to manufacture goods in Asia where costs are lower. China itself has risen dramatically off the back of the need for Western markets to produce electronic consumer goods to a culture hungry for information-rich gadgetry to support digital lives.
Some reading suggests that Foxconn employs about 142,000 people in China. Statistically, 10 suicides in two years is lower than the average for a city of the same size. Also, the culture of 12 hour shifts and wages are not unusual in China as a whole - a country with epic unemployment problems. Foxconn is suggested as being one of the better employers in the region and the recent media attention has actually prompted them to boost wages by 66% and look into improving psychological wellbeing in its factories by providing counsellors. It may be that Foxconn has actually become one of China's better employers.
But all this is speculative and I have no real facts to work with. The wider issues here are twofold:
1) How is global politics effected by the increasing dependency on China as a political entity to provide cheap consumer goods to the West?
2) Is the Chinese work ethic something we can accept as conscientious consumers and, if not, do we have alternatives besides living the lives of Luddites?
HTC may have an answer as far as phones go as they produce their handsets in Taiwan, which has better working conditions than the Chinese mainland. It is still, however, part of the Republic of China and the long working hours and low wages (compared with Western manufacturers) still remain.
Personally, I'm not convinced Apple are the bad guys in all of this. To be financially viable as a business, they need to manufacture in line with their competitors and so this means manufacturing in Asia. Asian economies like China have grown massively thanks to Western consumer need in the last century and this rising economy has likely improved the employment issues faced by the world's most populous country - ethically this is a plus. Foxconn, compared with other manufacturers in the region, seem no worse than any other the culture and law allows and, following recent media attention, may be the best they've ever been. Also, Apple's environmental concerns in the manufacturing process are excellent - they are highly recyclable due to use of stainless steel and glass in favour of plastics and the process of manufacture itself is PVC-free, bromine-free, arsenic-free and mercury-free.
I feel Apple are being thrown under the bus by the media because they're a big target and getting bigger all of the time. They overtook Microsoft in terms of profitability in the last month and are launching two massive new products. Combine this with the economic-doom backdrop and a swathe of distaste at how controlling Apple are perceived to act as a company and how nitpicky and despotic Steve Jobs is often accused of being, and you have a great recipe for news stories.
I don't think Apple are any worse than any other technology company in terms of their ethics. And as for whether it's healthy for us socially to be so plugged into our gadgets or whether it's healthy for the West to depend so much economically on the East, these seem to be the way things are heading and nothing Apple does is likely to alter the political and social state of the world we live in.
As a computer scientist, software developer, and lover of progress, information, enlightenment, reason and connectivity; I cannot bring myself to dislike Apple because their products clearly embody so much thought, care, detail, reliability and passion. We're living in a digital age, an age of communication, collaboration and reasoning. And also of capitalism and consumerism, poverty, debt, hypocrisy and greed.
Can we justify all of our technology and the economy we built on it? I'm not sure. But I can't blame Apple for it and I don't think they're making the situation worse. Perhaps with time they will even help improve it but that remains to be seen.
So I've come full circle and asked more questions than I've answered. Any opinions then comments are most welcome :-)
Looking through old files and found this. Damn I was smart back then - I wonder what happened..
Earth. The blue planet. Third rock from the sun. Our home. A speck of dust in an unfathomable universe. And yet, to us, the Earth is an area far too vast and intricate to ever fully comprehend. And beyond that still, the borders of our lands and towns and villages. People live out their entire lives, rarely straying from their familiar territory. Many seem afraid of what may lie out there. Out beyond the Starbucks and McDonald's, the pubs and clubs, the corner off licenses and greasy fish and chip shops, past the parks and playing fields, the hedges and the streams, beyond the hills, valleys, and lakes, mountains, deserts, forests, oceans. Past the limits of our small and humble homeworld and into the infinity of the unknown.
The sheer size, scale and grandeur of the universe is awe-inspiring, the rugged and untamed beauty of our planet is breathtaking, the ingenuity and splendour of nature itself incomprehensibly spectacular. And yet, how many people stop and look and listen? And realise the beauty of existence? The preferibility of presence as opposed to absence? The magic of light, dark, empty, full, good and bad?
Life, examined closely, is a fine-tuned ballet of super complex mathematical precision and programming. It can be explained quite simply. You would, probably, associate biology with life. Right? A living being can be described as a biological entity of some kind, be it animal, plant or microbe. But what is biology? Merely a fine balance of chemicals, reacting in a manner which metabolises and generates electrical energy in such an intricate fashion that it forms self-aware, self-replicating units of life. And if we examine that chemistry under the microscope, we see that each atom is comprised of energy, manifested in condensed form. Chemistry is, to all intents, a means of describing the physical behaviour of matter. Chemistry is a level above physics. And physics, of course, is maths. Quantities changing, shifting and altering according to algorithms. Life is bound by mathematical precision. Matter behaves according to fundamental universal principles in the real world, much as it does in that of a computer game. But what is outside our box? How did the laws that we take for granted come to pass?
As human beings, we are all wrapped up in our own tailor-made universes. Too busy to sit and contemplate the obsurdity of the cosmos, to indulge in unadulterated thought and speculation. I wonder why we're here. All cogs spinning in a universal machine. But to any higher purpose? Surely this race of bizarre creatures serves no useful function? Are we here just for the hell of it?
I wonder if I'll ever get the answers I seek to my questions. But I say this now. I am very much afraid of death. And am dreading the day that I draw my last breath. Consciousness is the single most fascinating thing I know and I cannot comprehend the lack of comprehension that the lack of life and consciousness would bring.
But my end looms, many many horizons away. I try not to think about the end but it often returns to plague my thoughts. Death is inevitable. My memories and awareness seemed to fade in as I aged from birth to my present age of 18. Will my thoughts fade out similarly until I'm completely mentally deconstructed? Or is there a robust fundamental element comprising my being which exists in an untangible format long after the death and decomposition of my body?
I will probably never know... And so I believe I should live out each day of my life, doing my best to absorb all I can from this world before the timer runs out. To experience as much of life as possible before it's too late. To take more risks and have more fun, to live life in happiness, laughing and smiling, singing and dancing, running and jumping. A brilliant bouncing ball of appreciation, love, compassion and happiness.
The journey in via Houston had been fun. West Texas is absolutely _absolutely_ vast. Heading East from Santa Ana over the mountains, the landscape swiftly transformed into a pale, yellow smear of featureless and barren plains, interrupted occasionally by a lonely road cutting straight through the empty space. These vast horizons persisted for hours as we hopped across Arizona and New Mexico to the Texas border.
A dusty city materialised below. I asked the friendly flight attendant whereabouts we were. El Paso. I smiled and enjoyed the view of this desert city beneath, glad to see the welcoming signs of life amidst the emptiness. The attendant and I shared a moment as a granddaughter tenderly helped her centenarian grandfather through the plane.
"Man, what a sweet kid."
I smiled and sipped my complimentary Coke. US soft drinks have the dubious pleasure of being flavoured by the controversial high-fructose corn syrup. This sticky goop is a main ingredient in many American sweets and is well known for causing and contributing to health problems such as diabetes and obesity. Combined with bucket sized portions and the health issues that plague the world's wealthiest nation are suddenly less puzzling. And the free refills policy across the nation can't help much either.
Houston airport was a stampede of multi-chinned entities, bumbling about between gates and terminals. A charismatic crew of surly people carrier drivers whisked about the corridors, yelling at anyone in their paths.
"Beep beep!" barked a portentous gentleman as he encouraged me out of the way.
Many hours later, I awoke in my hotel in Channelside, Tampa. The rough weather of the previous night had swept away and the air was a warm caress of sunlight and humidity.
I explored the surrounding area in the inquisitive fashion that befits me. The weekend's highlight was definitely the Florida Aquarium. An awesome array of fish, birds, mammals and reptiles devoured my morning, follow by an afternoon whizzing around Tampa Bay watching dolphins.
Streamlined shapes slipped and sluiced and raced, splashed and spluttered into foamy depths. With over 400 Atlantic bottle-nosed dolphins in Tampa Bay alone, spotting these beautiful creatures held no difficulty.
I smiled and realised I had no idea what I'd done the previous weekend. Whatever it was, it certainly didn't involve dolphins. Refreshed, invigorated and happy, I returned to my hotel and investigated the possibility of refreshments.
Eeeeek! A mouse!
This cute little fella scrurried out in front of me in the hallway. Took some patience and quick reactions to catch him but here he is safe and sound in a temporary glass playground. He's currently washing his face a bit - I think he figures that if he's about to meet his maker then he'd better smarten himself up a bit!
Just kidding, I'm not going to hurt the little guy - just find him a new home! This town mouse is about to become a country mouse. Or at least a park mouse, anyway. To the Brynmillmobile!
So I bought a Macbook over the weekend.
As a complete Mac noob, I was wondering if any of you wonderful iPeople could recommend me your favourite apps, blogs, websites, tips and tricks.
And then to relax after the hard day, we headed off to Downtown Disney and got drunk. Gotta love America! Downtown Disney, by the way, is a street owned and maintained by the Disney Corporation but is open to the general public free of charge. They have bars, gift shops, restaurants and the like. Some of it is heavily Disneyfied, some of it is not. All of it is themed in some way. And it is, for the most part, awesome!
We started the evening well by going to the ESPN arcade. For the unenlightened, ESPN is the American sports TV network, and the ESPN centre is like a control room for all the current US sport. There are banks of monitors showing every possible popular sport with rankings, live scores and the like for baseball, football, hockey, basketball etc. Plus a huge arcade with a mixture of video and mechanical sports-based games. We all grabbed a beer and headed into the frey. We played air hockey, shot hoops, raced Harleys, beach buggies and went skiing. Good ol' fashioned American fun.
Then on to a restaurant for my first taste of authentic Mexican food! I had some spicey chicken, black beans, rice and plantains. Not really keen for black beans but plantains are delicious! Matt and Arion discussed the vast array of Tequila in the cabinet and I sat drowsily watching American families shuffle about outside in the cool, California night air.
The following day at work was a similarly confused affair but we got all we needed to do finished. Matt headed out early to attend another business meeting and left Arion and I to our own devices. I knew above all that, while I was in the OC, I had to go to the beach and stand in the Pacific for a bit. There's nothing quite like getting your feet wet in a new ocean, since each one is subtley different. The texture and colour of the sand, the temperature and hue of the water, the smell of the air, and the shape of the surf. That day there were huge rollers making their way in during the afternoon's high tide. Groups of surfer dudes were treading water as the waves pushed on through, catching the most collossal, and riding them into shore.
I removed my shoes and socks, rolled up my trousers, and allowed the cool water to flood the spaces between my toes. Boy, that felt good. I gave Arion my camera to play around with while I phoned my parents. Well, I had to, didn't I? "Guess where I'm standing...?" Had to be done, I'm sorry. The surreality was so delightful that I had to share the moment. And, in true Trigger-Happy styling, my situation was well conveyed through shouting into a mobile phone amid the deafening roar of the approaching ocean.
Huntington is a stunning beach lined with giant palms, beach huts, trendy restaurants and the like. There are plenty of volleyball courts, frequented by brazen dudes with torsos the size and shape of armchairs, and admiring beach chicks in tow. And there is a long and attractive pier heading out into the depths.
I wandered up the pier with Arion as he leant out to snap pictures. Dizzy with excitement and happy in the sun, I ambled along absently through a crowd of hispanic kids. Arion pulled me aside shortly afterwards and gave me a few hushed words of advice. Looking back, the kids all had shaved heads. Shaved heads and matching white vests, pants and trainers. Quite feasibly, Arion warned, members of a gang. "Walk around the group next time, Sean. You have to show some respect."
And fair enough. American gang culture is legendary and terrifying to contemplate. California alone has over fifty recognised gangs, each acting as a separate entity. Feeling glad that my ass remained uncapped, I promised myself to be more forward-thinking in future. You can never be too careful in a place where any kid in a shell-suit could be packing a 9mm...
Arion and I returned to the car and arranged to meet Dana further south at a rooftop bar called El Casa del Caminos. Cruising down the Pacific Coastal Highway, we could hardly believe the size and positioning of the properties in view. Huge terraces and French windows, overlooking perfect beach views as the sun set vividly in the West. Amazing properties. Many of which were probably available at a similar price to your average terraced property in London! What a stunning location.
Up we went to the rooftops to find Dana waiting for us. The rooftop bar was very Mediterranean-looking and commanded an amazing view of the bay below. A few beers and cocktails later, our conversation was interrupted by a Jay Leno lookalike who took a keen interest in Dana. I knew she was in trouble when he started complaining about his wife and talking about why he was such a big shot. We played along politely for a while, giving the shameless charlatan enough rope to hang himself with. I couldn't resist asking him if he knew how to get to the Playboy mansion and I'm still unsure if he even realised I was taking the piss... Anyway - it was evidently time to vacate!
After a quick dinner, Dana took us up the street to what the Americans refer to as a dive bar called The Sandpiper (which I believe is a type of bird living on the Pacific). It was packed out with a colourful array of Californians - the trendy kids, the stoner dudes, the surfers, the lone businessmen, the undying hippies, forever-young crones, fake-ID teens, gold diggers, tequila swiggers, and plenty of unclassifieds. I was delighted to see the bar stocked Newcastle Brown, a welcome relief from the light beer favoured in the States. We grabbed a couple of bottles and eased on down to the front for some easy skanking. The Sandpiper just got busier and busier until it was shoulder-to-shoulder crammed. I was taken aback to see girls peeing in the men's room to avoid the line for the ladies'. I think it was their "don't mind us!" attitude that surprised me most, but then, why should it be such a surprise? This was California, after all, home of the laidback open books. I laughed and smiled at the girls and they returned the sentiment as I rolled back out to the dancefloor and eased back into the happy pulsing movement of contented Reggae rhythm.
from Seventy-five Savage Sieves
at a Service Station in Seville.
That is all.
I can't help but notice how the Tesco money-machine has marketed new breeds of super-convenient consumer pits. We have Tesco Express, Tesco Extra, Tesco Metro, Regular Tesco. When are we due Tesco Lite? Tesco Extra Cold? Tesco With Lime? Tesco Mach III Turbo?
How about Tesco Inferno, where the aisles are filled with flashing lights and pumping disco tunes? Or Tesco Extreme, where you have two minutes to get in and out before the staff chase you out with paintball guns?
Meaningless marketing hype. Gotta love it.
My eyes burned as they adjusted to the bright desk lamp adourning the bedside table. As the painful blur gave way to hard clear edges, I gazed in disbelief at the red digits of the hotel alarm clock and let free a sigh of tired frustration.
But, of course, it wasn't 3.16 AM. In California, maybe, but in Swansea it was 10.16AM and my brain knew it. But wait. That clock says 3.16 AM... That clock agrees. My phone? Watch? Yup - a solid consensus. So that means? Yep. You're in California, genius. (I confess, I giggled like an excited schoolgirl when I recalled this.) And, since my brain was stubbornly conscious, I decided I may as well enjoy being here.
Looking out across my halflit room at the Double Tree, Santa Ana, I noticed with some amusement that my room had two double beds in it. Was it standard arrangement in the US for single rooms to be given two giant beds? What kind of leviathanic being would need to ever push the two together? I shuddered to imagine, and decided to fire up the coffee-maker. Nobody in the US bothers with instant, it seems, and everywhere I went there was a big, shiny coffee pot perched beneath a brown dribble of caffeinated wake-up juice.
I spent the hours leading up to sunrise preparing my new work laptop for the day ahead. It was a snazzy little beast with a finger-print scanning system. To log in, simply drag your lazy digit across the sensor and you're in. I amused myself with this novel mechanism as the coffee slurped and slobbered through the filter.
Dawn broke over California with a rose-orange glow. I looked out of my window onto the palm-tree-lined boulevard and absorbed the world around me. I noted with a grin (as usually decorates my face on reception of something vastly ironic) that the establishments lined up across the road seemed to sum up the culture that I had been told was typical of California. A solarium sat comfortably alongside a nail salon and beside this happy couple beamed the shop front of a dental surgery. I wondered idly if anyone had ever been to each in turn as they passed through on some unseen conveyor belt of beauty.
A group of Mexicans appeared in overalls and began repainting the buildings. It turned out I would see many such groups during my stay. Being a painter or gardener in Orange County must be two of the steadiest professions possible. Wherever I went, it seemed, buildings and gardens were bright and freshly painted with perfectly tended gardens and shrubberies surrounding. Each street, road, boulevard and avenue was lined with palms equal in height and shape. Not a single piece of litter rode the warm morning breeze drifting in from the Pacific. There was no graffiti. No grime. No stray leaves. Not a single feature out of place or, indeed, out of style.
I doubted whether anyone could actually be living in this place - it looked so perfect. Rather like a kitchen showroom or model village. Everything was in its right place. But yet, as the light grew and the world awoke, I saw this toy town come to life. Barbie and Ken and all their little friends arrived in the trademarked Blondemobiles and began another day of perfection in Southern California.
I joined Matt in the breakfast area downstairs and he beckoned me towards the buffet. Americans enjoy breakfast in a very similar way to the British. They fry and scramble eggs, sear sausage, sizzle bacon and toast toast. But a surprise lurks up their sleeves. Into this arena of cholestorol comes hurtling a stack of fluffy pancakes and a drizzle of maple sytup. On the same plate. Together. Wondering if the day's meals had anywhere left to go but downhill from here, I filled my plate and tucked in. Not bad, actually. Not bad at all...
Matt smiled and broke into a bright and warm story. Still a little dazed, I smiled and nodded as I guzzled down my breakfast. Fortunately, Matt really had the gift of the gab and shouldered the burden of conversation. He seemed a stereotypical picture of America. Broad features, white teeth, and the unmistakable energy and confidence that has come to typify the US in the world's eyes. I confess it's a gift I envy - Matt could strike up a conversation with virtually anybody about anything like it was the most natural thing in the world.
Despite sneering scoffery of this brash US trait which I had heard across so many conversations in the UK, I genuinely enjoyed this aspect of culture and wished more Brits would embrace open, honest and warm acceptance of new company. Sure, America as a nation has a terrible reputation for bigotry and xenophobia but, on the ground, in the coffee shops and shoe stores, the restaurants and malls, the coridoors and restrooms, people were smiling to each other with no need for justifcation. I don't see why anyone in their right mind would find this to be a bad thing.
Arion soon joined us at the breakfast table and the conversation turned to details of the day and the plan of action for when we arrived at our partnering company's office. Again, I managed to embarass myself in the parking lot by approaching the drivers door. (It wasn't to be the last time this happened either.)
Sunglasses on and windows rolled down, we hit the road and cruised to Anaheim...
I've had loads of feedback on my America post...#2 is on the way, folks - fear not! In the meantime, I've put a selection of my travel photos on Facebook* (http://www.facebook.com/album.php?aid=112958&id=564740511). There's a lot of aerial shots to give you an idea of what I was describing.
*Yes, I could upload them somewhere public but I haven't. Am I rubbish? Probably, yes...