a-ivanov / smart-home-2021

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smart Home

The project implements a "smart home". The house has sensors which are connected to the central server. Sensors send events when lights are turned on/off or doors are opened/closed.

Classes description

  • The system receives events of type SensorEvent
  • SmartHome – the home itself, it contains rooms
  • Room – a room, it contains doors and lights
  • Door – a door (interior or entrance one)
  • Light – a source of light (e.g. light bulb)
  • SensorEvent – physical world event
  • SensorEventType – event type (4 types)
  • SensorCommand – a command which allows programmatically manage the physical world (turn lights on/off, open/close door)
  • CommandType – command type (1 type - turn lights off)

Coding hints

Stick to generally accepted Java style guidelines (e.g. Oracle or Google) when you name methods, classes or variables. Apply same guidelines everywhere in the project.

Inheritance between classes is not particularly useful in this project. Try not to use it each time you think you need one.

Follow Tell-Don't-Ask principle during class interactions design.

There may be many potential reasons to change for a project. Keep in mind that the most probable ones for this project are:

  • New house objects
  • New event types
  • Increasing complexity of events

Separate configuration code (e.g. dependencies setup, changes frequently) from business logic code (e.g. opening door event handling routine, changes not so frequently).

Watch out for introducing leaky abstractions into your code (e.g. an abstraction for reading data must not know if the implementation does it with file IO or through network).

About


Languages

Language:Java 87.5%Language:JavaScript 12.5%