iut-cse/OOKata

OOP Child's Play: Day 5

ratulMahjabin opened this issue · 0 comments

Overview

One day Mr. Tom gave an amazing lecture on an OOP concept which describes the dependency of modules in a program. He often gives small class work to the students for extra marks. After finishing his lecture he gave a code which broke the rule of the concept(below)

public class ChineseFoodSection{
    public void makeChineseFood() {}
}

public class FastFoodSection {
    public void makeFastFood() {}
}

public class Restaurant{
    private ChineseFoodSection chineseFoodSection= new ChineseFoodSection();
    private FastFoodSection fastFoodSection = new FastFoodSection();
    
    public void processOrder() {
        chineseFoodSection.makeChineseFood();
        fastFoodSection .makeFastFood();
    }
}

Assumptions

Restaurant will introduce new food sections soon.

Task

Identify the concept and rewrite the program

Notes

The methods are abstracted. You are not asked to implement them.


Reminders

  • React to the problem if you find it interesting and helpful. This will help others to easily identify good problems to solve.
  • Feel free to comment about the problem. Is the description unclear? Do you think it is too easy or too difficult than what is mentioned? Comment about it.
  • Discussion about the solution is OK. But do not paste a solution here. Give a link to the solution instead.
  • Do you have an interesting problem? Post it.