Click here to Skip to main content
15,606,568 members
Articles / Programming Languages / Java
Posted 2 Aug 2018

Tagged as


2 bookmarked

Thinking Within the Box

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
2 Aug 2018CPOL8 min read
Language design differences between C/C++ and Java, and attempting to solve the fare evasion problem in French Metro system with that insight.

This article is in the Book Review chapter. Reviews are intended to provide you with information on books - both paid and free - that others consider useful and of value to developers. Read a good programming book? Write a review!

Note: Before you are quick to downvote this article, I want you to understand this is not your usual CS tutorial. This is a blog post on career and business ideas with insight on C/C++ and Java gleaned from reading The Garbage Collection Handbook.

No, your eyes aren’t playing tricks on you. You have not misread it. The blog title is not a typo! It is, in fact, intentional. I assure you this is not a click bait. It is not thinking outside the box but thinking within the box, per se. These two approaches couldn’t be more different, the former is looking outside in versus the latter’s looking inside out. In today’s blogpost, we will discuss of a case of Thinking Within the Box at work in computer science, particularly Java language design compared to C/C++ language and how it applies and will work in today’s business world and then we attempt to apply this methodology to tackle ongoing fare evasion problem in Metro system in France. Without delay, let’s get started.

What do I mean by thinking within the box? In its simplest term, it is contemplating within the problem constraints and using its circumstances to turn the problem around on its head to attack itself! The 1st example that quickly came to my mind, is vaccination. Below is an excerpt from Live Science Journal with explanation on how vaccination work.

A healthy individual can produce millions of antibodies a day, fighting infection so efficiently that people never even know they were exposed to an antigen. … Unfortunately, the first time the body faces a particular invader, it can take several days to ramp up this antibody response. For really nasty antigens like the measles virus or whooping cough bacteria, a few days is too long. The infection can spread and kill the person before the immune system can fight back.

That's where vaccines come in. According to the Children's Hospital of Philadelphia Vaccine Education Center, vaccines are made of dead or weakened antigens. They can't cause an infection, but the immune system still sees them as an enemy and produces antibodies in response. After the threat has passed, many of the antibodies will break down, but immune cells called memory cells remain in the body.

When the body encounters that antigen again, the memory cells produce antibodies fast and strike down the invader before it's too late.

Another instance I can find in martial arts is Judo where the Judo practitioner uses the oncoming force of attacker to overthrow him. In fact, in computer science, we also have a good example. Before I reveal my answer, let me give you some history and perspective on C language first. In the 70s and 80s, colleges were teaching C programming and students had a hard time grasping C and its pointers. To be fair to students, for a C/C++ veteran like me, I, too, sometimes have difficulty knowing exactly when to dereference an address/pointer, despite having written a pointer to pointer article (which is an advanced pointer topic) in 2003. However, there is no escape from understanding pointer and memory address in CS at that time, because underneath, it is fundamentally how computer works. Coupled with confusion that pointer can point to either a variable on the stack or an allocated memory on the heap which the programmer must remember to deallocate after use, else a memory leak occurs. C language and its pointers is, no doubt to many of us, a very hard beast to subdue and tame.

Come 1995, Java, a language created by James Gosling, was unveiled to the world which mentioned no pointers at all in its specification. How did Java (or rather James Gosling) accomplish that feat? Java is a garbage collection language and has what they called reference type which is essentially opaque pointer to memory that are automatically dereferenced and deallocated during garbage collection cycle. Garbage collector keeps track of all these references, so that after the memory is collected back, memory compaction is done and the addresses kept in those affected references are updated with the new memory address. This is the reason program execution is paused during GC.

This is akin to saying, “Hey, here’s a computer language without pointers”, but in fact, it is full of pointers disguised and renamed as references.

The Nobel prize winner, American economist, Milton Friedman said in his famous paper, "The social responsibility of business is to increase its profits", because corporations were owned by their shareholders, the only obligation of business is to maximise profits for the shareholders. Most top executives tend to achieve record-breaking profits though cost-cutting which, most of time, hurts its employees and customers and in turn affects the corporation negatively in long term.

IT centres and its operations are often labelled as cost centre (where all fats shall be trimmed) while sales department is undisputedly the profit centre. Nothing can be further from the truth. Without the IT centre, the sales department does not even have a decent product or service to sell. Small and medium IT companies often cut the essential operating cost of their IT service, causing the service unable to meet SLA, resulting customer not renewing the contract upon expiration. Even when company pay top-dollar for best sales person, profit is unlikely to be stellar.

Everybody has this horrible experience with automated hotline where you have to jump hoops to converse with a living customer support officer. My local telco came up with this idea of AI chatbot; That could be a brilliant cost-cutting move, except this chatbot isn’t exactly smart; It merely interprets and matches the asked questions to FAQ and redirects there without ability to resolve issues. I have already checked FAQ before resorting to chatbot. When any telco has good personalized service, that business shall have my money. To be honest, it takes a great leap of faith (to believe that additional business would have paid off the extra incurred cost) for any corporation to justify personalized service (for customer) where none of its competitors are currently doing.

Unless you have been living in a cave, film photography has been dead for some time and digital photography is the current trend. My friend, Marco is able to carve out a lucrative business running an analogue film processing lab, charging a premium for his service. His selling point is his photos are more authentic and his target customer are the well-to-do individuals who are willing to splurge for nostalgia. Music CD shops are closing down in droves due to rampant music piracy and easy availability of legitimate music streaming sites like Spotify and Apple Music. There are still brick and mortar music shops left, just that they are not selling CDs, but vintage vinyl records. Just because technology made the product obsolete, that doesn’t mean you cannot have a business selling them, if you know how to position your business and adapt the value proposition accordingly.

Finally, we have to come to the last part everyone has been waiting for! That is applying “thinking within the box” approach to fare dodging problem in French Metro system which has been haemorrhaging money for years. My proposed solution is actually very simple: Pass legislation to legalise fare dodging; Open 1 gate specially for them, remove its turnstiles, install CCTVs on all gates. Fare dodgers are only allowed to pass through by that free gate, no leaping over the turnstiles at other gates. It is up to the station to decide whether to hire enforcement officers to police the situation. It is perfectly fine not to hire any; that is, train station does not want to catch any cheater. No questions asked and no grudge held against the fare dodgers; they could be genuinely penniless or tourists who just got pickpocketed. But what if everyone just passes through the free gate? Then close that particular station for 3 months with reason given as insufficient funds to keep it open. Most importantly, keep the train stations very clean, nobody would voluntarily pay full fares for station with urine stench.

One could argue Thinking Within the Box can be interpreted as another form of Thinking Outside the Box, in retrospect. The key takeaway, I want, for reader is: When all fails, when all the tried-and-true methods fail you, be not afraid to try opposite, go against conventional wisdom.

Note: In case the reader is puzzled why I discuss about business ideas in a CS blog about career. Knowing to code to the IT architecture isn’t necessarily enough for you to climb the corporate ladder, you have to know business side of things. If you like this blogpost and would like to read more of this stuff, click subscribe to this blog, because future career related post would not be posted to Reddit C++ Forum and C++ Enthusiasts Facebook page due to their non-C++ related nature.

Reference Material

The Garbage Collection Handbook (2011) by Richard Jones, Antony Hosking and Eliot Moss: The insights were gleaned from this book when I wanted to create my own OO scripting language.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior)
Singapore Singapore
Shao Voon is from Singapore. His interest lies primarily in computer graphics, software optimization, concurrency, security, and Agile methodologies. His hobby is writing a free C++/DirectX photo slideshow application which can be viewed here.

Comments and Discussions

-- There are no messages in this forum --