Skip to content
Caleb edited this page Sep 22, 2023 · 1 revision

Welcome to the xmaplib_keyboard wiki!


This project has been my testbed for some new software architecture best-practices and patterns.

My opinion is that it has been a massive success in that regard. The codebase size to functionality is exceptional--

I believe I have achieved my stated goal of reducing most of the unnecessary structure that would be inherent in a similar "traditional" mid-2000s style OOP designed system.

This was achieved in large part due to dividing the architecture into algorithms and containers, per Klaus Iglberger and his book (and C++ conference videos) entitled

"C++ Software Design" (2022).

Initially, my thoughts on utilizing more free functions consisted mainly of things like "how do I know which ones should be free functions?", but after a short introductory period to actually using the design it quickly becomes the preferred approach.

A pitfall I encountered was not immediately recognizing: "I do in fact need an abstraction" sooner, such a decision should probably be made Before attempting the alternative for a while.

To Summarize

  • Don't begin your work by creating abstractions that you don't need, always evaluate the usefulness of adding a class.
  • Recognize quickly when you do in fact need an abstraction (container class), and don't waste time working without it.
  • Classes exist to encapsulate some data, not the functions.
  • The problem of programmers reaching in to touch data they should not be able to was such an excessive problem that OOP has overtaken the world--but the one simple thing most implementations forget is this: functions that do not touch private data do not need to be encapsulated at all--and should not be!
  • Basic guidelines on determining if a function should be a free function (residing outside of a class) include,
  1. If it is possible to implement the function via the class's public interface, then it does not belong in the class.
  2. If the function can be made a "static" member function, then it should be outside of the class.
  3. Functions are algorithms, with a broader definition of what most would think of when they hear the word "Algorithm".
  4. Classes are containers, similar to STL containers that exist to encapsulate some data, no other purpose.

The results of this, to my mind, have been profound. It is the architecture used by the C++ standard library, many Boost libraries, and many other excellent pieces of software.


My Vision For XMapLib_Keyboard's Future

  • Small
  • Fast enough
  • Easy to modify
  • Easy to extend
  • Flexible enough to support new use-cases
  • Exceptional

Flexible, and Exceptional small library for adding controller input to action mapping.

Clone this wiki locally