GoTeamEpsilon / angular-to-react-redux

Angular to React/Redux, a Guide for Angular v1 Experts Looking to Learn React/Redux
MIT License
107 stars 12 forks source link

Setup Java REST API #59

Open MatthewVita opened 7 years ago

MatthewVita commented 7 years ago

This is a task for @ericarao to put all of the concepts that she and I have been overviewing to action. This API will be used by the Angular and React/Redux applications to edit/read basic patient information as well as edit/add/delete/get contact information.

Tasks

MatthewVita commented 7 years ago

@ericarao feel free to create a server folder in this repo where you can put your code.

chanceencounter commented 7 years ago

@ question#3: By entities and repositories, is it only applicable to Spring MVC/Boot? Dropwizard uses dao and abstract resource design, I think.

MatthewVita commented 7 years ago

Yeah, you're an owner on this repo so feel free to edit the task list to whatever the terms are for Dropwizard. I've heard Entity, Resource, and Model for what I call Entity. I've heard DAO and Repository for what I call Repository. It's all the same conceptually.

MatthewVita commented 7 years ago

Need any help with anything BTW? Things going smoothly?

chanceencounter commented 7 years ago

@MatthewVita Mostly. I want to try doing it with both but am definitely less familiar with Spring. The documentation on the Spring website is pretty good. Although the internet seems to think the bug is a maven issue, I'm inclined to think that since part of the errors I'm getting is talking about missing beans, I'm supposed to define the beans with the @Bean annotation.

MatthewVita commented 7 years ago

@ericarao don't worry about Spring... you're making great progress with DropWizard! Great job!

Some questions:

chanceencounter commented 7 years ago

Yuuup. Copypaste issue. Was being lazy. WHOOPS.

Egg is some vernacular thing I picked up from Kevin, it just means an incomplete object (minus ID) so it's an "egg" that hatches into the full object.

MatthewVita commented 7 years ago

We should follow Domain-driven design (DDD) as much as possible. Stolen from Wikipedia:

Entity

An object that is not defined by its attributes, but rather by a thread of continuity and its identity. Example: Most airlines distinguish each seat uniquely on every flight. Each seat is an entity in this context. However, Southwest Airlines, EasyJet and Ryanair do not distinguish between every seat; all seats are the same. In this context, a seat is actually a value object.

Value Object

An object that contains attributes but has no conceptual identity. They should be treated as immutable. Example: When people exchange business cards, they generally do not distinguish between each unique card; they only are concerned about the information printed on the card. In this context, business cards are value objects.

Aggregate

A collection of objects that are bound together by a root entity, otherwise known as an aggregate root. The aggregate root guarantees the consistency of changes being made within the aggregate by forbidding external objects from holding references to its members. Example: When you drive a car, you do not have to worry about moving the wheels forward, making the engine combust with spark and fuel, etc.; you are simply driving the car. In this context, the car is an aggregate of several other objects and serves as the aggregate root to all of the other systems.

Domain Event

A domain object that defines an event (something that happens). A domain event is an event that domain experts care about.

Service

When an operation does not conceptually belong to any object. Following the natural contours of the problem, you can implement these operations in services. See also Service (systems architecture).

Repository

Methods for retrieving domain objects should delegate to a specialized Repository object such that alternative storage implementations may be easily interchanged.

Factory

Methods for creating domain objects should delegate to a specialized Factory object such that alternative implementations may be easily interchanged.

chanceencounter commented 7 years ago

I'm having issues where basically I'm registering that I need the naming strategy to be set to snakecase or something similar because postgres is case-insensitive (would prefer not to have to do a workaround where I put everything in "quotations") so my camelcase stuff would just be like postCode -> postcode, so I changed it to snakecase, but I'm having an issue where Jackson doesn't seem to register it as "oh serialize and deserialize using the snakecase rule". So it just bricks because it's doing camelcase still.

screen shot 2017-02-03 at 3 34 20 pm screen shot 2017-02-03 at 3 44 03 pm

chanceencounter commented 7 years ago

At the moment I'm kinda staring at all the things Jackson is doing under the hood, trying to figure out if this is a Jackson issue or a configuration issue on my end.

chanceencounter commented 7 years ago

Please ignore, problem fixed.

MatthewVita commented 7 years ago

@ericarao Things are looking good!

It looks like the "egg" concept is a https://en.wikipedia.org/wiki/Data_transfer_object I'm a big fan of consistency, so let's use this in the relevant class names. Server-side folks should, in theory, be able to switch from codebase to codebase without much confusion with names, concepts, etc.

MatthewVita commented 7 years ago

Moving this to 1.0.1 release because it probably won't be done in time for 1.0.0