As introduced earlier, the project design starts with listing general entities, such as users, products, and warehouses when designing an e-commerce platform:
We then decompose each entity into smaller components. To make things clearer, consider each entity as a separate class. When thinking of an entity as a class, it makes more sense in terms of decomposition. For example, we express the user entity as a class:
class User
{
public:
// constructors and assignment operators are omitted for code brevity
void set_name(const std::string& name);
std::string get_name() const;
void set_email(const std::string&);
std::string get_email() const;
// more setters and getters are omitted for code brevity
private:
std::string name_;
std::string email_;
Address address_;
int age;
};
The class diagram for the User class is the following:
However...