Residential Tower Project - Structure Revision
Quick revision of the main nodes and their relationships before coding:
π’ Tower β Floor β Apartment β Contract β Rules
1οΈβ£ Tower
- Direct info: name, number of floors, apartments per floor (optional)
- Calculated/total info: total apartments, total population, total rent, total bills/services (only for included services)
- Acts as the container/manager of all floors
2οΈβ£ Floor
- Direct info: number, type (GROUND, NORMAL, TOP, UNDERGROUND), height, dimensions (width Γ length)
- Calculated/total info: population, rent, apartment stats, bills/services (only included)
- Groups apartments and makes calculations easier
3οΈβ£ Apartment
- Direct info: coordinates/ID, size (width Γ length Γ height), maxHousehold, current household size
- Status info: AVAILABLE, RENTED, UNAVAILABLE
- Contract history: may exist or not; apartment itself stays the same
- Represents the physical unit; status changes but apartment persists
4οΈβ£ Contract
- Tenant info: name, start/end dates
- Lease info: rent (monthly/yearly), included services, max household, penalties for extra people
- Rules: embedded in contract β whatβs allowed, billed, included
- Each new contract is created when apartment is leased/renewed; enforces the rules
5οΈβ£ Rules
- Could be embedded in the contract
- Examples: max household, service inclusion, fines, renewal rules
- No separate object needed unless reusable templates are desired
β‘ Key Ideas
Apartment β fixed physical unit
Contract β dynamic occupancy & rules
- Totals are always calculated live from apartment status + contracts
- Services included vs. tenant-paid changes whether it counts toward landlord totals
- Contracts create the business logic: occupancy limits, fines, included services
Structure Diagram (Conceptual)
Tower
ββ Floors
ββ Apartments
ββ Current Contract
ββ Rules / limitations
Notes:
- Each apartment exists before and after contracts; contracts come and go.
- Tower queries all floors/apartments/contracts for totals.
- This hierarchy allows clear separation of physical units vs dynamic lease/rules.
β
This revision serves as a reference for coding the project, ensuring consistency and clarity.