Viktor Peller

This user hasn't shared any biographical information

Homepage: http://viktorpeller.com

Tech Interview – Improve the Algorithm

Adding new files to our database increases the processing time significantly. This is because the algorithm we use is not efficient. Let’s recap how it works. After we read the database in, we have a list of Person instances, and every Person instance maintains a list that tells which other people this person likes: If […]

Leave a comment

Tech Interview – Non-recursive Tree Traversal

In the previous part we extended the database structure and now it supports sub-directories. The algorithm that walks through the directory structure is based on recursive calls. Many times recursion results a nice program structure, but it also has its drawbacks. What if we want to process the data – like files from a directory […]

Leave a comment

Prevent Stack Overflow in Recursion

In the previous part we solved a problem using recursion. In this solution a method keeps calling itself. When a method calls a method, it has some administrative cost, it needs memory. For example, the CPU needs to know where to continue the execution of the program code after it returns from a method, so […]

Leave a comment

Tech Interview – Recursive Tree Traversal

One of the improvements we need to make on the Like Statistic application is to change the structure of the database where the datafiles are stored. The database is a directory with datafiles, and the program reads all datafiles from that given directory from a single level, but doesn’t read those from the subdirectories. In […]

Leave a comment

Expression Tree Based Activators

In the previous part, in the convention based factory, we used the Activator class CreateInstance() method to create a parser dynamically using a type information. This solution works well in our example, but there is a faster way to create class instances than using Activator.

Leave a comment

Tech Interview – Refactoring V – Convention Based Factory

In the previous part we fixed the code which reads the Person instances from the datafiles. A part of this code was a Factory class based on a switch statement. This solution is ok, but when we add a new parser, we need to remember to add a new case block to the switch statement. […]

Leave a comment

Tech Interview – Refactoring IV – SOLID Refactor

In this part we are going to refactor the parsers and the factory method more, utilizing design patterns and the SOLID principles.

Leave a comment