Category : architecture

I have a project, which has its own filesystem. The class basically looks like this: class ResourceManager { public: std::string readFile(std::string const&); private: std::vector<std::string> root; }; This class is used everywhere in the project. So it’s global and have a single instance. My current solution is that I create an instance in the main function ..

Read more

This question is more about application software architecture design, but links, libraries, samples of code would really help. Situation: I have my network console application (The Application) written in C++ running on 400+ PC that are distributed between several networks. Each instance of The Application is connected to bunch of instances of The Application and ..

Read more

When writing code using C, the code must include the main function. I always had a question about this. In the case of Python or JavaScript, the main function is not required. However, in the case of C, why should I include the main function? Does this improve performance? Or is it just to distinguish ..

Read more

I wonder the following code is valid, or not. In main function, the ‘testValue’ of the member on ‘testClass’ will be set. If printed by calling ‘showTestValue()’ method, the variable must be updated? Or the variable may be not updated in some cases ? #include <stdio.h> #include <stdlib.h> class testClass { public: int testValue; static ..

Read more

I have posted some questions here before about library design in C++ and the answers helped me much with proceeding with implementation. I am currently refactoring my code and the goal is to split a single class into multiple classes handling different functionalities. Here’s some dummy code illustrating my ideas. MyLibrary.h #ifndef MYLIBRARY_H #define MYLIBRARY_H ..

Read more

Well, i have the next C++ code: #pragma once #include "position_data.hpp" #include <cstdint> enum class e_color : uint32_t { green = 0u, blue , red }; class render_data_t { }; class render_2d_data_t : public render_data_t { public: float get_local_x() const { return m_position.get_x(); } float get_local_y() const { return m_position.get_y(); } void set_local_position( float x, ..

Read more