Elegance Can Be the Enemy of Efficiency

I’ve been auditing some of the advanced Scala courses offered by École Polytechnique Fédérale de Lausanne, and as always am curious about my own solutions compared against what other people come up with.

One of the things I love about Scala is its elegance. Once you understand the language, you can achieve some really complex things quickly and easily — and, elegantly. So, a problem posed in the coursework is to write a function that, given a character in a game field, returns the first index of that character in the field.

After writing my own solution, I Googled a few other solutions. Here’s one:

def findChar(c: Char, levelVector: Vector[Vector[Char]]): Pos = {
   val ys = levelVector map (_ indexOf c)
   val x = ys indexWhere (_ >= 0)
   Pos(x, ys(x))
}

This is pretty elegant. In fact, I was first taken by how functional it looked — more functional than my own code. But there’s a problem. This elegant code is potentially very inefficient.

Let’s assume the game field is big. It consists of a Vector of Vectors, and the above code searches the entire game field. That is, even if the character matches the very first element in the field, all the rest of the elements will be scanned:

  1. ys maps over the entire Vector of Vector scanning for the index of c.
  2. x then scans the vector ys for a positive hit.
  3. Then the coordinate is returned from the points described by x and ys(x).

So the obvious problem here is our elegant, functional, good looking code could be terribly inefficient. Here’s my implementation:

def findChar(c: Char, levelVector: Vector[Vector[Char]]): Pos = { 
   @tailrec def iterate(x: Int): Pos = levelVector(x).indexOf(c) match { 
      case y if y > -1 => Pos(x, y) 
      case _ => iterate(x + 1) 
   } 
   iterate(0) 
}

Ok, it’s not as pretty, it’s longer, but — it’s still functional by design. More important, it will look for the character using a linear search, and stops when it finds the character. It’s efficient:

  1. We start in the first Vector, checking for the index of the character.
  2. As soon as we find it, the function returns. Otherwise, it recurses and moves to the next Vector.

It’s not as pretty but it preserves efficient design. Just because we can write pretty, elegant code doesn’t mean we always should.

Incidentally, you could also achieve nearly the same efficiency using something like this:

val row = levelVector.indexWhere(_.contains(c))
val col = levelVector(row).indexOf(c)

Personally, I prefer to avoid any potential inefficiency — but, over-optimizing can also be a problem. It’s probably best to find a happy balance. Don’t ignore efficiency, but don’t spend all your time optimizing situations that, quite likely, don’t really need the effort.

Engagement Style And International Success

If you missed the first part of this six-part series, see: Part 1 of the series, Creating An International Culture Of Success, or see the entire series right here.

Engagement Style

Do we get right down to business, without knowing much about the other person — or, do we build a strong and trusting relationship, only talking about business after we know each other well?

Sending a delegate to represent an American company must be well thought out before departure. This delegate must have authority as well as longevity in the organization. Replacing delegates during the relationship should be done with care and planning. The new contact will need to be brought in slowly to transition the relationship. It is wise for American firms to engage more than one delegate to a relationship with the BRIC or they risk the business leaving with a delegate who departs. — Moore, Brandi, The Little BRIC Book.

Most cultures throughout the world choose the latter path: A relationship-driven engagement style. Conducting business outside of the “in group,” the trusted circle of family, associates, and professional contacts that you know well, is unheard of. It is far better to go into business with someone that you know well, even if the price or product isn’t the best. You know what you’ll be getting. Furthermore, the combined influence of your in group means everyone will do their best for you — and if they don’t, there are always solutions to improve the situation.

The Western, venture-driven style is very different. It’s found in relatively few cultures — probably less than 10% or so of the world. America is perhaps the most dramatic example of a culture that believes in doing business first. It’s a message driven culture, promoting products, uniformity, and a “best product and best price gets the business” ideal. Some of this ideal is beginning to leak into other cultures, but culture doesn’t change quickly.

The Global Project Compass identifies the following management disciplines as being most directly affected by engagement style:

  1. Accounting Policy & Costing
  2. Risk Management
  3. Procedure & Outsourcing Management
  4. Business Continuity & Recovery
  5. Information Assurance & Security

Accounting Policy & Costing

Policies regarding accounting and cost management are deeply affected by engagement style. Strongly relationship driven cultures tend to support more relaxed, flexible policies when it comes to managing the flow of money. This flexibility affords hiring family members, awarding favored contracts to close allies, and giving favors such as gifts for professional favors.

Unlike relationship driven cultures, many cultures focus on cost and performance first, and enact policies accordingly.

Venture driven cultures tend to support stronger accounting and cost management policies, leaning more heavily on the rules of business. This is particularly true in countries such as the United States, Switzerland, and Germany. In such cultures, the favoritism afforded by strong relationships is regarding as nepotism or corruption.

It’s important to remember that both systems are unique and both kinds of cultures feel their system works very well.

Risk Management

Different cultures approach risk from very different perspectives. Cultures that prioritize relationships tend to view those relationships as a means to avoid risk. Awarding an important contract to a close relative or friend provides security. The close relationship helps eliminate unknowns. While price and performance may not be the best, they are known. The strong “in group” network that defines the relationship means everyone will want to support the in group. Performance becomes a matter of saving face.

Venture driven cultures tend to equate risk reduction with choosing the best performer. Giving favored treatment to friends and relatives is viewed as a risk, and potentially disastrous. This usually means taking as objective an approach as possible. Contracts are awarded based on price/performance analysis, and risk is reduced by evaluating past performance. Contingency plans for poor performance generally involve financial penalties or having a contract revoked (not something a relationship driven culture is comfortable with).

Procedure & Outsourcing Management

As pointed out above, the typically “Western” venture driven style eschews anything that seems like favoritism. When talking about outsourcing this is probably one of the biggest differences between venture driven and relationship driven culture. The relationship driven culture will stick to its in group, favoring existing relationships. The venture driven culture assumes that every project must be objectively awarded based on performance criteria.

This also shows up in organizational procedures. Venture driven cultures tend to have written procedures that are enforced through business mechanisms (such as forms, systems, and policy review). Relationship driven cultures, on the other hand, rely more on informal, cultural procedures. Important policies are enforced not by forms and systems, but by the peer network and cultural environment.

Business Continuity, Recovery, & Security

Who is responsible for the continuity of the business? Many venture driven cultures will push for a separation of concerns, using an objective, often outside third party. This might be a service provider responsible for auditing and securing an information network.

Relationship driven cultures tend to prefer a more closely-held approach. Sensitive information is often controlled internally, and important individuals within the organization are tasked with ensuring continuity.

Each culture’s approach to security and information management can be very different. Probably the most dramatic example of this is the American view on intellectual property protection versus that of Chinese culture. While China is definitely changing, the American perception that intellectual property is owned and protected by law is not commonly shared in China. We routinely hear stories about how products are copied in record time in the Chinese market — and U.S. firms are constantly evolving strategies to stay ahead of the Chinese copycats.

Cover graphic attribution: The artist and visual designer Yang Liu was born in China and lives in Germany since she was 14. By growing up in two very different places with very different traditions she was able to experience the differences between the two cultures first-hand.

Where To Invest Around The World In 2014

Are you looking to diversify your investments, spreading your money around the world? It’s a great idea. A multinational investment strategy protects you from fluctuations in one region. But in today’s tumultuous world, with geopolitical upheaval and unsteady markets, where should you invest?

Daniel Altman may have what you need. In Foreign Policy’s Where To Invest Around The World, 2014 Edition, he offers some great insight. His Baseline Profitability Index (BPI) maps economic growth, financial stability, physical security, corruption, expropriation by government, exploitation by local partners, capital controls, and exchange rates. His goal: To map the total pre-tax return on investments in a region.

Baseline Profitability Index (BPI)
Baseline Profitability Index (BPI)

Darker countries indicate a higher score on Daniel Altman’s Baseline Profitability Index for 2014, meaning they are a better bet for foreign investment. The index considers asset growth, preservation of value, and repatriation of capital. Botswana ranks the highest in 2014 with a BPI value of 1.31; Venezuela ranks the lowest at 112, with a score of 0.63.

As Altman writes, the shifting global landscape has moved a lot in the past year: “In just the past 12 months, quite a lot has changed in the global investing environment. Some struggling economies have found their feet, notably in Europe, while others around the world have fallen victim to conflict. A few have improved their economic institutions, too; neighbors Greece, Macedonia, and Turkey all bolstered legal protections for investors, and nearby Azerbaijan strengthened its property rights.”

This year’s edition of the index has a few changes over last year. Most notably, a new source is used for measuring the likelihood of government expropriation. Altman is using the Index Of Economic Freedom in this 2014 edition.

The index suggests that not every fast growing country around the world is a great target for investment. You need to take into account the risks of each market — that’s the purpose of the index, after all. But it’s also important to make an educated decision. All indexes have their limits. For example, after switching to the Index Of Economic Freedom, China dropped from position 21 to 43 on the BPI. While the new approach is hopefully more accurate, it also illustrates why it’s important to understand the data.

Despite the change to the Index Of Economic Freedom, and shifts in the geopolitical landscape in the past year, India has maintained its position at number 6 on the index. Altman feels this is, “In large part because of the potential for real appreciation in the rupee.” He adds, “This may now be more likely than ever, thanks to Narendra Modi’s supposedly reform-minded government and the strong hand of Raghuram Rajan at the central bank.”

Creating An International Culture Of Success

The International Business Dimension

Multinational teams present new challenges for the International manager. There are logistics problems: How do you coordinate teams that work in different time zones? What kind of collaboration can you create in a team that rarely sees one another?

As well as the logistic problems come cultural problems. For example, successfully creating a culture of innovation can be a challenge. Honeywell experienced this, according to a November, 2013, Time article, when Rameshbabu Songukrishnasamy began working as general manager of the company’s R&D centers in Shanghai and Beijing. He found his employees were not innovating. They weren’t tinkering or inventing on their own — not a positive sign in an R&D lab! “They were happy just doing what they were asked to do,” Rameshbabu says. The problem is, R&D is about doing something new.

A project manager for a large corporation in Brazil recently told me that the PMI Book of Knowledge is used infrequently at best inside Brazilian projects. He also warned against assuming that someone with a PMI certification has extensive experience, as is the case in the US. — Moore, Brandi, The Little BRIC Book.

Rameshbabu found that his Chinese workers had a fear of failure. They worried that the company would be upset if their work did not yield positive results, so they didn’t experiment. Another problem is that some Chinese engineers “tend to shy away from critical questioning,” a process that is fundamental in R&D. “The reason they are able to make so much innovation in Silicon Valley is that people question the status quo and find alternative ways,” says Rameshbabu. But he found that Chinese culture and education focused on rote learning, not critical thinking.

Creating A Culture Of Success

Creating successful International programs requires understanding and adapting to different business cultures. Applying Western management practices in Asia will fail, just as surely as transplanting Western employees into an Eastern environment. Imagine an independent, critical thinker from Silicon Valley landing in Foxconn, Shenzhen — where challenging the status quo is forbidden.

Team dynamics play a huge factor in management style, objectives, and capabilities. Building a culture of innovation is just one example of where these dynamics become complicated. Power distance will affect everything from goal setting to how problems are socialized. Communication style can quickly lead to misunderstandings. Differences on the fluidity of time can mean completely missing the mark with customer deadlines. And differences in identity and engagement style can lead to initial confusion, bad first impressions, or distrust.

This is why understanding business cultural practices is so important. Hyrax International LLC has a program that explores each of these five preferences. The program examines each of 27 different management disciplines, such as goal setting, risk management, change management, and assessing outcomes. The affect of business culture on each discipline is explored and explained, providing a road map to success on the International management scene. The company also offers many free resources to explain and explore International project management, and is also sponsoring Successful International Project Management, an in depth book that maps project management processes to cultural preferences.

We’ll be posting five more parts to this article (read Part 2, or see the entire series right here) in the coming couple of weeks. Each post will look at one of the five business cultural preferences, and briefly introduce how that preference impacts and affects the 27 management disciplines.

Hyrax International LLC’s Global Project Compass™ is the only visual map that clearly shows the connection between business culture and business process. This is what makes Cross Cultural Management™ so much more effective than traditional management.

The Compass maps 27 project management disciplines directly to business cultural preferences, and shows how these preferences affect business. The goal of the Global Project Compass, and Hyrax International’s associated management program, is to show how culture affects businesses worldwide — and to provide a clear map on how businesses can adapt successfully.

Did you know India has a little more risk today?

Euler Hermes, the 100-year-old trade credit insurance firm, has a fantastic little tool for assessing credit risk around the globe. Euler Hermes monitors country risks in 241 countries and territories. Their country risk map aims to assess the risk of non-payment by companies in a given country.

In other words, if you’re thinking of developing a new market, you can use this little tool to see how likely (or unlikely) it is you’ll get paid. The map is interactive, and updated periodically to reflect changes in the global economy.

As many of you know, we do a lot of business in India — so, I was pretty surprised to see that Euler Hermes upgraded India from “low risk” to “medium risk” this year. In retrospect, while it took me by surprise, it probably shouldn’t have. India still suffers from an immature business market. I can see how this can translate into higher credit risks.

Country Risk Map
Country Risk Map, Euler Hermes (click to open)

It also underscores how important it is to work with a trusted source, and an experienced partner, no matter what country you go into. Euler Hermes is one such resource when it comes to insuring your revenue stream — whether its import/export, manufacturing, or even R&D. If you’re doing International business, trade credit insurance is a must, and these guys know how to do it well.

Getting back to India: Yes, maybe it is a little bit more risky today, at least when it comes to credit risk. But that’s no reason to stay away, it just means you need to account for those risks. Engage with a partner that really knows how to work with India, take the right precautionary steps (such as using trade credit insurance), and move forward with your eyes open. India is an incredible market opportunity, and not one to shy away from!

How Do I Find The Right Global Partner?

Businesses are thinking bigger now. Your partners need to understand your values, win business and support contracts for you, and vice-versa. But, finding the wrong global partner could be a huge blunder. Here are few tips to help you make the right decision.

Hi, I am Zacharias Beckman, president of Hyrax International and today I want to talk about finding the right partner to go into business with, overseas. A lot of our customers come to us because they are in business with the wrong partner. They found a great looking ad on the internet, they sourced a request for proposals, and they got back an excellent response. Before you know it, they’re signing a contact and they’re going into the business — really, with somebody that they don’t know.

The problem with this is that, on an international scale, contracts don’t mean the same thing that they do locally. Part of this is just a practical matter. Enforcing a contract overseas is very hard. It’s expensive, it’s time consuming. But more important than that, is that relationships are the core of business in most of the world. That means that to find a really good partner you have to build a relationship network. You’ve got to have feet on the ground, overseas, building connections that you can use to find partners that are trustworthy. Those connections are what’s going to help you find the right partner, internationally.

The most important thing here is that, when it comes to finding a partner overseas, you need to have a relationship. You need to have feet on the ground, you need to build a trusted network, and you need to create a relationship based in more than just a written contract. And you need to understand the culture in which you are doing business, so that you really know how to relate to and build that strong relationship with your new partner.

Why we can’t just burndown everything

Prashad is the project manager for a new product. After reviewing the project scope, Prashad’s team gives it an initial estimate of about three to four months to complete, which is good enough for management. The project kicks off, and using Scrum along with a little bit of project management, the project gets underway. The first month goes quickly, there is great progress, and everyone loves what they see. But in the second month, things start to slow down — so, Prashad adds more resources to the project to compensate. But by the third month, there are real problems and it looks like the project will be late. Prashad adds even more resources. Now the team is almost double the original size. He adds a lot more quality assurance and testing support for the team, too, because a lot of problems are cropping up. The team cranks away, and they finish the project in the fifth month, and claim “success” because they almost hit the deadline (it was, after all, just an “estimate“).

But what about all those additional resources? Is it really success if the project cost twice as much as originally estimated? The problem is, that cost was never formally stated. It was never tracked as a metric, so the fact that the project went horribly over budget is quietly swept under the rug — at least this time. There are plenty of cases where the budget isn’t there, or the resources aren’t there, or the product just can’t ship late.

So, if so many projects are missing their mark, what’s causing the problem?

The fallacy of so called Agile methods

According to studies conducted by KPMG, as much as 70% of projects fail to meet their goals. In this case, “goals” mean quality, schedule, and function (or a combination of those). Clearly, being able to accurately estimate a project’s delivery date is important. Without knowing when a project is done, you can’t predict cost, plan business operations, or dovetail releases with marketing, training, and customer service.

Agile methods like Extreme Programming and Scrum make promises that, in my opinion, they can’t keep. For well over a decade we’ve seen an increasing trend in project failures, and a large number of those failures are the result of “unending projects.” Projects that go on and on, continuing to deliver improvement but slowly creeping over budget and never reaching an end state. Part of the problem is the lack of formal estimation and metrics.

Both Scrum and Extreme Programming dodge the entire issue of project life cycle estimation. They focus on the near term, providing estimates for the next one or two sprints. This works great if you don’t have budget or time constraints, but in the real world that’s rarely the case.

Burndown just doesn’t work

Most Agile methods don’t explicitly define how you estimate progress, but the most common method is burndown — the measurement of completed effort against the planned sprint goals. This is fine for a quick-and-dirty project but as a strategy it utterly fails to pinpoint problems with budget and timeline. For anything larger than a few months effort, it doesn’t do the job.

And the problem is, few of today’s engineers seem to be getting the formal education and training needed to use proper estimation methods.

There are better solutions than burndown

Earned Value Management, or EVM, is nearing it’s 40th year of practice. Throughout this 40 year history, EVM has repeatedly evolved to meet new demands as technology and innovation made new leaps forward. It’s a proven method for measuring progress and it’s been proven time and again.

Of the dozen or so software engineers I spoke with about this article, none of them had even heard of EVM.

Earned Value Management, as well as a variation known as Performance Based Earned Value® (PBEV), are my favorite choices for estimating a project. The PBEV approach provides an incredibly robust method for measuring progress and staying on top of your project. It’s only marginally more difficult than other techniques of measurement. And most project managers are already capturing the metrics needed to make it work.

PBEV is an improvement over Earned Value Management Systems’ (EVMS) national standard. It supplements EVM with guidelines for the integration of project cost, schedule, and technical performance — thus created a comprehensive and highly accurate method for measuring true progress in a project. The key here is integration of effort with schedule and performance.

Had Prashad been using PBEV, he would have had a very different experience. The early estimates would have been more accurate, since PBEV estimates the entire project. It would have measured not only resources and cost, but also the actual performance — the rate at which work is being done. Had the project gone off track, Prashad would have known much more quickly, and would have had a more precise picture of how to correct the project’s course.

There will definitely be situations in which PBEV is not warranted, and a skilled project manager will need to know when to use other methods, and why. EVMS, for instance, addresses only the quantity of work completed, ignoring cost and schedule metrics. The implication here is that a quick burndown or EVMS-based evaluation of a project might look A-OK, when in fact the only reason it’s on track is because resources are being thrown at it — and costs are skyrocketing.

Burndown versus critical path thinking

Burndown is a very simple method for estimating work effort over a short term. It explicitly avoids timeline, cost and performance metrics. That’s fine for projects that are not constrained by time, budget, or resources. The problem is, burndown is used as a defacto standard too often, on the promise that using an Agile method will deliver a project faster or cheaper than its alternatives. I don’t disagree on this front. Agile methods generally are faster and cheaper — but the question is, faster and cheaper than what?

Most business need to be concerned with time, money, and staffing. Projects that have those constraints need to think about the critical path — the sum of all activities to reach the end of the project. Having a solid understanding of the fundamentals of critical path management is important to managing any project schedule. Depending on the nature of your project, you may be able to rely on casual effort estimates — or, you may be required to carefully identify, analyze, and attack critical paths to shorten your project lifecycle and stay within stringent guidelines. Without understanding the principles, and knowing where to turn for more information, neither is possible.

I’ll revisit the topic of PBEV in a future article and provide more depth into how it can be applied to a project. If you’re eager for more information, check out Performance-Based Earned Value®, Paul J. Solomon, Ralph R. Young, IEEE Computer Society, Wiley Interscience, 2007.