Coding workouts

Improving team hard skills

Edison Rodas
Globant
3 min readNov 1, 2022

--

Photo by Edgar Chaparro on Unsplash

To reach mastery, practice is the best. Coding is not different, so every developer should do some exercises periodically.

A better way to practice and adopt the mental ability to solve problems is by solving problems. But what kind of problems?

Coders can practice and improve their coding skills with katas. Coding Katas was coined by Dave Thomas, co-author of “The Pragmatic Programmer,” from the Japanese martial arts where warriors practice their movements over and over until they domain them.

A coding kata solves a trivial problem with low essential complexity but lets developers share different versions of the solution and learn new ways to do it in terms of efficiency and performance.

We developers love variety and learning new things constantly. Friday is an excellent moment to perform coding katas with the team; near of weekend could be a little more relaxed and good to enjoy learning and encourage them to practice the new knowledge the following week.

Following, I present some kata exercises to practice coding skills with Javascript. The goal is to get a better version of the problem solution.

Some recommendations:

  1. Understand the exercise.
  2. Check the test criteria. What is the input? What is the output?
  3. Make a first version that meets the test criteria.
  4. Improve the version to learn new concepts.

Creating a fake dataset

A program that given a number N input, returns a JSON array size N or random objects with properties like name and phone numbers with consistent values. No libraries or npm packages can be used.

Goal: use of arrays, single responsibility principle, and make data from a few seeds.

One version of the solution:

One solution version with random functions and Array.from method

Searching array elements into another array

A program that returns an array with an id and name from another big array (1 million elements) dataset when ids in the input array (1,000 elements) are a match.

Goal: order of magnitude algorithms, time complexity concept, improving performance with hash tables, and Map object use.

Solution 1: O(MN) search using arrays methods, if M is the large array size and N is the small array size.

Results:

Solution 2: O(M)+O(N) search using Map object; O(M) is the map creation, and O(N) is the searching.

Results:

So now, if we run these couple of programs for searching 10,000 elements in a 1 million elements array. The results will be even more meaningful.

Solution 1 results: O(MN) search

Solution 2: O(M)+O(N) search

Conclusion

Coding katas are a pretty good instrument to promote knowledge transfer and excellence at work in software engineering teams. Tech leads and engineering managers can lead this kind of exercise as part of the maturity process of the hard skills of the team.

Prepare your katas with a specific goal according to your team's needs. Some useful links with problems proposals are:

--

--

Edison Rodas
Globant

Passionate about technology, cloud, and business. Software Engineer. Music hunter. | Tech Manager at Globant