Get Fit with Algorithms and OOP

Get Fit with Algorithms and OOP

Hello and welcome to "Object-Oriented Algorithms Workout" article series, where I will explore such topics as data structures, algorithms and object-oriented design! My name is Evgenii Terekhov and I am glad to be your guide through this exciting journey.

My Journey: From Ignoring Algorithms to Embracing Their Importance

For the past decade, I have been writing Java code that is more or less object-oriented. I initially held the belief that algorithms had no place in the software I was creating, which led me to neglect learning them. This lack of knowledge made me blind to their importance in software development.

However, I've recently had a revelation. I realized that I do, in fact, write algorithms. They just don't resemble the ones you'd typically find in a textbook. Instead, my code is heavily factored into different classes, which obscures the underlying algorithmic structure. This realization has led me to appreciate the subtle presence of algorithms in my work and the need to understand them more thoroughly.

Why This Article Series? Bridging Algorithms and Object-Oriented Design

That's why I've decided to create this article series on the intersection of object-oriented techniques and algorithms. My goal is threefold:

  1. Learn algorithms and implement them in Java.

  2. Practice object-oriented design and transform the initial algorithm into an object-oriented form.

  3. Hone my refactoring skills while performing such a transformation. I intend to show how the transformation could be done safely, using the smallest steps and always relying on tests.

By bridging the gap between the classic "look" of algorithms and the object-oriented code that I usually write, I aim to gain a better understanding of how to combine the best of both worlds.

Our Resources: Algorithmic Thinking and Object Calisthenics

For this series, I've chosen to use two primary reference materials: the book "Algorithmic Thinking" by Daniel Zingaro and a small article "Object Calisthenics" by Jeff Bay.

Zingaro's book provides a comprehensive and accessible introduction to algorithms, making it an ideal starting point for people who are just beginning their study of this fundamental aspect of computer science. It offers a clear, step-by-step approach to algorithmic thinking that I believe will be invaluable to our journey.

Bay's article on Object Calisthenics presents a set of rules aimed at improving software developers' abilities to write well-structured, easy-to-maintain code. It aligns perfectly with my goal of practicing object-oriented design and transforming algorithms into an object-oriented form.

I'll share the Object Calisthenics rules here and elaborate on them in the next article:

  1. One level of indentation per method

  2. Don’t use the ELSE keyword

  3. Wrap all primitives and String

  4. First class collections

  5. One dot per line

  6. Don’t abbreviate

  7. Keep all entities small

  8. No classes with more than two instance variables

  9. No getters/setters/properties

By combining the insights from these two resources, I aim to provide a well-rounded exploration of both algorithmic and object-oriented thinking in this series.

Join the Journey: Perfecting Your Skills in Algorithms and Object-Oriented Design

Whether you're a seasoned developer or just starting out, this series has something for everyone. So open up your favorite IDE, and let's get started on this exciting journey together!