You are here:

C++/Learning algorithms/data-structures, C++ and design patters

Advertisement


Question
I would like to brush-up my algorithms/data-structures knowledge and sharpen my C++ skills. For this, I've decided to pickup a standard algorithms text book and start understanding and implementing the popular algorithms in it using C++(I know it would take some time to finish this task but I think it's worth the effort).

It would be great if I could implement and learn design patterns too as I go along. However, on the outset, I don't see how one would apply design patterns while writing a simple algorithms/data-structures library - for example, would most of the design patters be used? And wouldn't it feel like I am shoehorning a design pattern into my code just for the sake of it? Like, lets say I am implementing graph traversal algorithms: would I really *need* to use design patterns for that? Wouldn't my attempt to deliberately use design patterns, irrespective of whether they are needed or not, make the code unnecessarily complicated?

Should I discard the idea of design patterns for now and just focus on the algorithms and then take up a separate initiative for design patterns?

Answer
> Should I discard the idea of design patterns for now and just focus on the algorithms and then take up a separate initiative for design patterns?

That would be my recommendation.

However, when you get into design patterns, you would realize that many of them can be used in conjunction with algorithms. The Strategy and Template Method patterns to provide variability, the Abstract Factory pattern for creation of algorithm objects etc.  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.