Skip to content
Command, Repository and Mediator Design Patterns episode artwork

EPISODE · Jun 3, 2016 · 2H 8M

Command, Repository and Mediator Design Patterns

from Coding Blocks

In this episode we go back to the design pattern well that we've been away from for so long. We cover the Command, Repository and Mediator design patterns. It was hard for us to believe, but it's been almost a year since our last design patterns episode!!! Come on in for fun, learning, and of course, our tips of the week. See the original show notes at: http://www.codingblocks.net/epsiode42 Leave us a review here: http://www.codingblocks.net/review News Stitcher Reviews: Spectre013, Christoffer, Genius, HAM3rtag, joe_recursion_joe, Gearhead2k, Manriquey2k, Mike North, AndrewM, MildManneredCalvin, Freeleeks iTunes Reviews: Sid Savara, J. Mair, tonicorb, Nmkel999, Eschwartz20, mochadwi, Banjammin, wisco_cmo, NewZeroRiot, Nate_the_DBA, Pauloispaulo Joe's chess game! Joe on Hello Tech Pros Software Engineering Radio #256 on Unit Testing !important is a CSS code smell. Do you name your IIFEs? You should. This is our 5th, Design Patterns Episode. Last one was in July 2015. 30: Adapter, Facade, and Memento 19: Iterators, Observers, and Chains 16: Strategy, Template, Null Object 11: Factories, Factory Methods, Builder, Prototype What type of development do you prefer? Front-End Back-End Full Stack Design Patterns - Command, Repository, and Mediator Command Pattern Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undo. It's not "method()" it's "new Object(), and later...object.invoke() Why? Nice, clean way of organizing your code. Especially if…. OO replacement for callbacks - meh Specify, queue, execute Undo Transactions/Logging Not mentioned: Macros Async Real World Applications GUI/Menus - copy/paste/undo/photoshop Video Games Age of Empires sent commands rather than the game state! It's not if("B") { jump(); }, if(input[k]) { input[k].invoke() } Great for different contexts, like menus Parallel / Tasks Async/Await Queues / Multi-Step Wizards Queue up the commands, execute all at once Restaurants???? How it's done: Client: Customer Receiver: Waiter I/Command: Order Invoker: Cook Great example on sourcemaking.com What about callbacks? Why not the observer pattern? Challenge for the listeners, program the command pattern - do it "by the book" Repository Pattern Why? Testable with isolated data layer Centrally managed access rules and logic Centralized caching strategy Allows you to separate business logic from data access logic Strongly typed entities Business entity associations Can apply a domain model to simplify business logic Decouple business entity from data storage technology - the repository doesn't expose where it gets its data What? Sits between the data source and the business layer Maps data from the data source to an entity Persists changes from the entity back to the data source Can use the Unit of Work pattern for complex, multi-step operations Typically utilizes a Data Mapper Pattern, or an ORM such as Entity Framework in .NET Mediator Pattern What is it? The mediator pattern defines an object that encapsulates how a set of objects interact Source: Wikipedia Promotes loose coupling by keeping objects from referring to each other explicitly Promotes the Single Responsibility Principle by allowing communication to be offloaded to a class that handles just that. Similar to the Observer pattern Mediator pattern can be implemented during the observer pattern, The Observer pattern distributes communication by introducing "observer" and "subject" objects. Also similar to the Facade pattern in that it abstracts functionality of the classes. Examples Chat room Air Traffic Control Button events? Resources We Like http://gameprogrammingpatterns.com/ https://msdn.microsoft.com/en-us/library/ff649690.aspx?f=255&MSPPError=-2147217396 https://genericunitofworkandrepositories.codeplex.com/ http://blog.falafel.com/implement-step-step-generic-repository-pattern-c/ http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php https://sourcemaking.com/design_patterns/command https://sourcemaking.com/design-patterns-book http://www.codeproject.com/Articles/526874/Repository-pattern-done-right https://en.wikipedia.org/wiki/Mediator_pattern https://sourcemaking.com/design_patterns/mediator http://programmers.stackexchange.com/questions/134432/mediator-vs-observer Tips of this Episode Allen: Want a JavaScript tip per day?! http://www.jstips.co/ Bonus!!! Want tons of cheap stuff?! App called "Geek" - download it on iOS or Android Michael: Use Nunit's TestCaseSource to test objects in your test cases How to delete/forget about a wireless network in Win8.1 netsh wlan show profiles netsh wlan delete profile name="gogoinflight" SOURCE: http://www.digitalcitizen.life/how-delete-forget-wireless-network-profiles-windows-81 Joe: Learn a new language! Stretch the brain, learn new concepts and see old concepts in a new light! Scripting, Compiled, Functional - Conway's Game of Life!

Episode metadata supplied by the publisher feed · Published Jun 3, 2016

Embed this episode

Ready to play

Command, Repository and Mediator Design Patterns

0:00 2:08:04

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

No similar episodes found.

Unshamed & Unchained: Carving Space For Self-Healing & Habit Transformation Danny Poelman Welcome to "Unshamed & Unchained: Carving Space For Self-Healing & Habit Transformation", the podcast where we break the chains of shame and societal expectations to create a safe space for self-healing, habit transformation, and personal growth. Hosted by a seasoned life coach, Danny Poelman DDS, with years of hands-on experience, this podcast is your guide to reclaiming your voice, embracing your story, and living life on your terms. In each episode, we dive deep into the topics that matter most to you—whether it's: -breaking free from unwanted habits like pornography -excessive people-pleasing -healing from past trauma -recovering from narcissistic abuse or religious/relational trauma -anxiety/depression -money mindset blocks -overcoming limiting beliefs We’re not afraid to talk about the things that are often considered taboo, because we believe that through honest, unfiltered conversations, real transformation happens. You’ll hear real The Triathlon Mental Performance Podcast Neil Edge This podcast is for you if you are a Triathlete that is interested in learning about tools and strategies to overcome challenges and to utilize the power of your mind to race faster. I'm an experienced Triathlon Mental Performance Coach working with both Age Groupers and Pros. Episodes will cover the following and more. How to improve your mental toughness Removing the possibility of panic attacks in open water Removing the fear of fast descents on your bike - Removing mental blocks to improve your race times Completely remove performance anxiety (you don't have to just cope with it) 4 weeks to race day - Strategies to arrive at your a-race feeling calm and confident, with race day mental strategies I will also talk about specific tools that you can use to ensure that you race faster. <b BAT Community Podcast BAT Community & Brave Basic Attention Token (BAT) is a revolutionary digital advertising and rewards platform from the inventor of JavaScript and co-founder of Mozilla and Firefox that rewards users in Ethereum-based BAT tokens. Brave is a fast, BAT-powered privacy browser that blocks all 3rd-party ads and trackers by default. Learn more about BAT, Brave and tech with this podcast! The Belief Breakthrough Show Tina Encarnacion The Belief Breakthrough Show is all about breaking past limiting beliefs and shifting perspective to achieve the life you dream of. The show is hosted by Tina Encarnacion the Author of Stuck In The Fire, Reiki Energy Healer and Trauma & Abuse Coach. Each month she brings on eight guests that focus on a specific limiting belief to help the listeners breakthrough their blocks and get closer to their destiny.

Frequently Asked Questions

How long is this episode of Coding Blocks?

This episode is 2 hours and 8 minutes long.

When was this Coding Blocks episode published?

This episode was published on June 3, 2016.

Can I download this Coding Blocks episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.
URL copied to clipboard!