I had the opportunity of doing my second presentation of the Design pattern series of presentations which my self and Vidula were doing alternatively. This time it was the Composite pattern that I had to present on. Got a bit too busy and the slides which I created for the purpose was something I didn't feel proud about, it was a bit incomplete and I just scrapped through explaining the essentials of the pattern in a half an hours time.
And then came the question of the day! Harsha presented the audience and myself with a question to try.
He simply asked us to use the composite pattern to solve a search problem????
"The question"
Suppose you have a gui like follows,
How is it possible to use the composite pattern to create the where clause of the sql statement dynamically?
It was a nice question to make us think about the composite pattern and its practical application.
This in turn led to an interesting discussion on topic.
The solution to this, as explained by romith, was to have the AND and the OR as the nodes and the criteria like the Name , City etc as the leaves!
Initially I thought that the Name, City and NIC could be made into nodes and have the AND and OR as the leaves.It was quiet rightly pointed out by Harsha that it would work , but was not the correct answer, as it was not a scalable solution and having it the other way around would provide with an extensible and a scalable solution.
I ended this presentation with a lot of self satisfaction as it was a presentation that I left with a clear picture about the topic than the idea that I had at the start of it! But ironically I was the presenter.. haha poor audiance!
7 years ago
No comments:
Post a Comment