Newer
Older
Import / research / ui / toolkit / TODO.txt

TODOs:

  Remove PicoPNG.h and put wrapped function in Graphics.h
  Make it clean C++11 and C++ APIs
  Make the cross-platform support more seperated
  Add non-C++11 support
  Add Doxygen commenting
  Clean up build system
  Add cross-platform font / text support


API Design
----------

  style guide / guide lines

  Perhaps base on something like this:
    - https://google.github.io/styleguide/cppguide.html

  some formalized rules and conventions for the design of APIs will
  have some of the following benefits
    - following the rules will make it easier to create a new API
    - it will help to ensure the correctness of the API
    - it will help with the use of the API

  examples:
    - naming conventions
       - if on an adhoc basis, names of functions were decided, then
         one function to get the foo variable might be named getFoo().
         And if there are no rules, the name of the function to get
         the bar variable might be called bar().
         On the other-hand, if following a rule, when creating the
         function, if the rule is get + variable name in camel case
         then the functions become getFoo and getBar.
         a user doesn't need to look up the API, it will be as they
         expect.

   naming:
       camel case
       class name start with upper case
       member functions start with lower case
       abbreviations are to be avoided on APIs
         (abbreviations can be used within an implementation, but not on the interface)

   const correctness:
       - <need to enumerate rules>

   pointers and references:
       - A star ('*') style pointer implies it is nullable
       - An ampersand ('&') style reference means it can not be null
       - Prefer to use references where possible
       - Avoid pointers and nulls.
       - Avoid raw pointers and prefer smart pointers where references can't be used
       - make ownership clear - owning pointers, borrowed pointers - perhaps need classes

   calling conventions:
       return by value
       pass by reference and const reference where applicable
       - <need to enumerate rules>

   includes:
       put in the cpp file instead of the h file
       use #pragma once instead ifdef guards

       forward declare classes to avoid includes
       don't forward declare functions
       prefer to include files in the cpp files rather than the h files
       - exception to this is templated classes where you should include

       rational - dramatically can speed up compile times
         - if have correct dependancies, what gets recompiled will be dramatically less
         - of what is recompiled, it will be recompiled faster also
         - promotes passing objects by reference
       
       Wonder if it is possible to automate?

   avoid threads
       if use threads, use carefully and try to synchronize them with another thread
       try to use a thread pool with a task queue for concurrency
       try to be more functional, with referential integrity or what ever it is called

   scopes
       use the namespace feature, but avoid using 'using'

   move callback virtual functions to be protected. they are for reimplementation.
   make the API clear that a function is for calling by a client or is for reimpl
   to extend functionality.

   try to loosely couple components together, such as with connect so they don't
   become dependent on each other