A clear thought process helps coders to get to the solutions. This post simply walks you through my thought process of how to implement some very basic data structure - a stack and a queue.
1 Comment
BDD is basically TDD done properly. It is an agile methodology for building a shared understanding of what software to build by discussing using examples. It is a technique that uses a business language to define acceptance criteria. It is about figuring out what to build with an outside-in approach - having conversations, capturing conversations, automating conversations. In other words, first think about what you’re about to write, then think about how you would test the code, before writing it.
BDD is not an agile project framework (e.g. SCRUM) nor a project management approach. Mediator pattern is a behavioral pattern that coordinates and encapsulates many-to-many communication/interaction among related objects (Colleagues) so that Colleagues interact not directly with other independent Colleagues, but indirectly with other Colleagues through a centralized Mediator. source: GoF Bridge pattern is categorized as a structural pattern in GoF because it structurally decouples abstraction from its implementation so that the two can vary independently. However, it is very similar to Strategy pattern which is categorized as a behavioral pattern. source: GoF Strategy pattern is a behavioral pattern that lets the algorithm vary independently from clients that use it by defining a family of algorithms, encapsulate each one, and make them interchangeable. An algorithm that's encapsulated in this way is called a strategy. Strategy is concerned with changing the behavior of an object. source: GoF In this post, I note the approach and my thought process about determining whether a given smaller tree (t2) is a sub-tree of another larger tree (t1). First, the approach: Since I know t2 is smaller and it is to be matched/found in a larger tree t1, I'll take the approach of scanning through the larger tree t1, and t1's children, by trying to find a match of t2 in t1's left child tree and find a match of t2 in t1's right child tree, recursively. The Visitor Pattern is a behavioral design pattern that allows you to define a new operation to be applied to different classes of elements (also known as Visitable classes) without modifying those element classes directly. This pattern groups the same new operation together using a Visitor class, which contains separate member functions for each kind of Element/Visitable class. overviewVisitor pattern lets you add a new operation to a structure of objects (Visitable/Elements) to be traversed through, without changing the Visitable/Element on which it operates. Visitor class separates would-be virtual functions of the Visitable/Element class into a Visitor class. Each Visitable/Element should implement an accept(Visitor) function which delegates the request to the underlying Visitor class via calling visitor.visit(this) from accept(Visitor). Each concrete Visitor class implements a set of visit(Object) functions that does the real work for the operation to be applied to the structure of objects. Each visit(Object) function takes in a different type of concrete Visitable/Element object. The Visitor can optionally maintain a context during a traversal. source: GoF |
Categories
All
Archives
May 2020
|