Project

General

Profile

Hangman Example, Auth Session vs. Db Session

Added by I. Lazaridis about 10 years ago

One problem with the examples is the missing documentation.

For example the file hangman/Session.C

https://github.com/kdeforche/wt/blob/master/examples/hangman/Session.C#L95

It does not clarify in the header what this file is about.

Looking at the code, the Session class handles the User (Session) Authentication.

But, within its constructor, the database session object is created.

This is misleading (session/session), and the database initialization belongs (strictly) not within the Session.C code.

At minimum, the database related code should be moved out to its own file (decoupling, clarity).

For reasons of decoupling and clarity, the database code should be moved out of this file (global db code to a file like "Database.C", user related code to the class User).

If for any reason the code hast to be "as is", then this should be mentioned/documented.


Replies (1)

RE: Hangman Example, Auth Session vs. Db Session - Added by I. Lazaridis about 10 years ago

(Note that I've not read the hangman tutorial. This is the only way to rate the quality of the code. The code should be self-explaining, and contain some basic documentation.)

    (1-1/1)