GoF: Gang Of Four
Abstract Factory Pattern
(aka. "Interfaces")
Designing by Interface makes such a difference when it comes to setting up the scope of the work to be done, (imho).
Due to my participation in the Post Graduate Program in Data Science from Purdue University, (which specializes in Machine Learning and AI), a side project of mine that focuses on the game of Chess, (ChessMind), ran into a CRC 32-bit collision.
PLEASE NOTE: If you do take an interest in the Post Graduate Program offered through Purdue via SimpliLearn.com be sure to make sure ALL you business dealings are with SimpliLearn.com and not SimpliLearn.net. Someone appears to have taken the .net variant and are trying to get people to purchase additional courses through your email and not the website itself. The people are SimpliLearn.com are legit, the people operating SimpliLearn.net appear to be anything but.
Now this is not the first time I've tried to piece together, (from scratch) my very own chess game project. The first few attempts were in Java, but now since I've made my way back to the wonderful world of C++, I am finding it simpler to implement, (but not so easy to do without the use of interfaces).
GIVEN we need focus when developing software
WHEN we take the time to specify an interface before writing code
THEN we are able to focus on developing code that is necessary
WHEN we take the time to specify an interface before writing code
THEN we are able to focus on developing code that is necessary
Like capturing a Gray outside of AREA 51, the two strings below generate the exact same 32-bit CRC value:
Design by Interface
JIRA entries lend themselves well to Interfaces
A well defined interface should have a related JIRA entry. Something that can be explained in terms of GIVEN, WHEN & THEN. In this way, not only can we identify the work to be done but also keep track of the work to be done using test cases and source repositories.
JIRA is a popular online website for specifying, managing and distributing software development components and task.
Hoare Logic is a popular method of specifying the task to be done in Given, When, Then format.
Wikipedia's "Design by Interfaces" description
"Design by Interface" tends to quickly identify easier ways of doing things:
In the above diagram you can see an MVC, (model-view-control) designed with the Observer specified as a interface, (as opposed to a class). In the Observer interface the update() method has been declared. It is up to each class that implements this interface to define an update() method, (and adhere to it's specification).
GoF: Abstract factory pattern is one of the foremost authorifies on the use of interfaces in software developement.
Header files before the use of Interfaces
Without a properly defined interface, any number of header files can be developed, (trying to resolve one issue after another). A bit like throwing rocks at the broad side of a barn to get it to fall down. This is not a good way to program software.
All those header files now reduced down to just one interface:
With a properly defined interface, a skilled software developer can quickly see what the original objective of the software's inception was, (plus it's current state of affairs as well as what options are available for further development).
Custom exceptions? It is generally a good idea to define what possible exceptions might arise out of the interface's methods with the definition of the interface.
The pure keyword? C++ hasn't added a keyword by the name of pure, but a skilled C++ developer knows that defining a keyword as pure is much better than using the C++ standard '= 0', (as it describes the interface specification better). In the world of C++ there is no calling of a pure virtual method, (just it's derivative). In the world of interfaces there is no instances of interfaces, (just classes that implement them).
Mocking Framework, (Eran Peer's FakeIt C++ tools)
"Design by Interface" tends to quickly identify easier ways of doing things:
From a cost/time saving perspective, it is advantageous to develop your interface using tools that simulate implementation code. Otherwise, you'll find yourself writing a lot of boilder-plate code that tends to consume time and energy as methods are either added, changed or deleted on your interface specification.
FakeIt a popular C++ interface mocking framework.
Test Driven Development, (with Catch2)
"Design by Interface" tends to quickly identify easier ways of doing things:
You might think that going through the trouble of specifying an interface is just too much of a waste of time, (with few benefits). Yet, even in adding this to my blog, I was able to identify an easier method of implementing the moves() method, (of the specified interface) just by adding it here. Such that, the original attempt to implement the moves() method brought in a number of issues, (you see reflected on the first tab). Now that we have a properly defined interface, I can see how merely counting the number of FEN line entries easily meets the requirements of this interface, (as all the issues related to reading SAN Chess format are now just an option and not a requirement as far as this interface method is concerned).
Catch2 is a popular C++ framework for writing test cases.
Source Code Repository, (Linus Torvald's Github)
"Design by Interface" tends to quickly identify easier ways of doing things:
Keeping track of new features and changes to current functionality requires a good method of managing different versions of source code, (whether alone or within a team of developers). Linus Torvalds invented Git 15 years ago in order to continue development of the Linux kernel. The original team could no longer use BitKeeper. At the time, no other Source Control Management (SCMs) met their specific requirements for a distributed system, (Apr. 15, 2020).
Github.com is a popular source code repository.
PERRY ANDERSON: IT CONSULTANT PORTFOLIO