java - Creating objects with different properties -


i confused on how object oriented perspective maintainability in mind. taught when designing application think change. trying spend time on personal project design, heck may want change later. application inspired newest game called division. calculator damage per second.

the technologies have chosen spring, rest, hibernate, angular.js 1.0 , maven. possibly bootstrap unsure @ moment because focusing on end. these technologies understand aren't needed level application doing learning purposes.

now since have of understanding of project is, issue having. having hard time making server object oriented regards pojo.

in division have weapons , gear. weapons can have different mods , attributes. not weapons can have same mods such assault rifle can have scope why shotgun have scope? attributes relative same weapons mods vary depending on type of weapon used. gear, gear can have different attributes based on type of gear is. gloves can have attributes increase critical hit chance while backpack has attribute increases ammo capacity. gloves can't have attribute of ammo capacity , backpack can't have critical hit chance.

both gloves , backpack gear not same type of gear. same thing weapons, both assault rifle , shotgun weapons not same type of weapon. thought creating super class called gear , weapon , subclassing different weapons/gear. confused on how professional perspective , best learning experience design.

this looks use case decorator pattern .

do go through link: https://sourcemaking.com/design_patterns/decorator

it has similar example using weapons.

basically decorated used when want add additional properties object dynamically.

create decorator of type moddecorator(base class) , have specific mods extend . dynamically can ad these mods weapons .

i not familiar types of mods/weapons/gear/attributes unable give specific answer go through link.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -