Hi all,
I had a short question, I am busy making an UML Class Diagram for my future text-based browsergame, and I was wondering if I do it right yes or no.
Please give me your critic and comments.
Kind regards,
Schoorsteen
Hi all,
I had a short question, I am busy making an UML Class Diagram for my future text-based browsergame, and I was wondering if I do it right yes or no.
Please give me your critic and comments.
Kind regards,
Schoorsteen
Nice start, — and thanks to for prompting a rethink. A few practical, complementary points to tighten the design and make the UML more useful as you turn it into working PHP.
Keep domain boundaries explicit. Group related behaviour into small, testable aggregates so each class has a single responsibility. Represent financial behaviour with an accounting model (accounts, immutable money value objects and transaction records) rather than scattering balance logic across many domain objects. That makes rules, audits and concurrency much easier to reason about. Use integer-based amounts (cents) to avoid floating point errors and keep a durable transaction ledger for every state-changing money operation.
Separate domain logic from persistence and orchestration. Use repositories or DAOs to hide storage, factories for complex construction, and services for cross-cutting operations that span multiple aggregates. Favor composition and interfaces over deep inheritance so you can swap implementations (in-memory, DB, test doubles) without changing the domain model. Add a thin application/service layer to enforce transactions and invariants atomically.
Make the UML diagram communicate intent. Annotate multiplicities, navigability and visibility. Mark aggregates and document invariants in notes (what must be true after each operation). Avoid modeling database columns or UI details in the class diagram — focus on behaviour and responsibilities. Once classes look stable, add sequence diagrams for common flows (create, transfer, join/leave group) to validate interactions and locking strategies.
Checklist before coding: define aggregate roots, choose storage pattern (ActiveRecord vs DataMapper), design a transaction model for concurrency, write unit tests for domain rules, and produce sequence diagrams for critical paths. Iterate the diagram after implementing small prototypes; the best designs evolve from simple, tested loops.
Jump to Post— darkagn 315Personally I find it difficult to critique UML when I am not sure exactly what you are trying to achieve, but I'll give it a go. It looks good except for a couple of things that I noticed.
First of all, you have a User having a Family, I …
Personally I find it difficult to critique UML when I am not sure exactly what you are trying to achieve, but I'll give it a go. It looks good except for a couple of things that I noticed.
First of all, you have a User having a Family, I think it could possibly be better to have the family having a list of users and functions such as isFamilyMember($user) . I think this would be a cleaner solution.
The other thing I noticed is that Users, Families and Companies all have a Bank object, and Users also have a Family and a list of Companies. This to me seems a bit too much, perhaps you need to think about what you are trying to achieve with your Bank object.
Other than that, the UML looks like a good start for how these classes might interact, but you need to keep in mind that PHP is not an object-oriented language although it does feature some support for classes.
Thank you very much for giving it a try, I understand it is difficult. Your comments made me start overthink my UML.
Your idea about isFamilyMember is quite a good idea and I will go for it.
You are also right about my bank, Users, Families and Companies will now implent the Bank class.
The goal I am trying to achieve here is setting up a decent framework for a browser game. I hope that makes it clearer for you and other people that are willing to comment on my UML. I will update the picture within the next hour.
Kind regards,
Schoorsteen
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.