Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(toh-6): refactoring of 'add, edit, delete heroes' #2170

Merged

Conversation

chalin
Copy link
Contributor

@chalin chalin commented Aug 22, 2016

Refactoring of "add, edit, delete heroes" section of toh-6 from one big bottom-up step into small independent feature slices, where the user achieves a "milesone" (i.e., can run the full app) after each feature section. The section rewrite is shorter and offers a better UX.

Other simplifications:

  • Error handling is consistent: in the hero service we log to the console, everwhere else we just let errors bubble up.
  • Hero service methods renamed based on function (create, update) rather then lower-level implementation (post, put).
  • @Output properties have been eliminated (since they weren't explained).

E2E tests now pass on both the TS and Dart sides.

Contributes to #1619.

+makeExcerpt(_appModuleTsVsMainTs, 'in-mem-web-api', '')
:marked
The `forRoot` configuration method takes an `InMemoryDataService` class
that will prime the in-memory database as follows:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will prime -> primes

(no need for future tense here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@chalin
Copy link
Contributor Author

chalin commented Aug 22, 2016

@kwalrath: a first pass at updated prose (see original comment for details). Once we settle on the prose we can ping the TS folks to review as well.

@chalin
Copy link
Contributor Author

chalin commented Aug 22, 2016

@kwalrath: post-review edits submitted.

:marked
The `HeroDetailComponent` does most of the work. All we do is toggle an `*ngIf` flag that
swaps it into the DOM when we add a hero and removes it from the DOM when the user is done.
The delete HTTP method will be used to delete heroes and its invocation is like to `put` except for the method name:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is hard to read and "like to put" isn't quite right. How about:

The hero service's delete method` uses the delete HTTP method to remove the hero from the server:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that original sentence certainly wasn't right. Fixed

@chalin chalin force-pushed the chalin-toh-6-hero-CUD-feature-silo-0822 branch from 84a61a7 to bafc01f Compare August 22, 2016 23:05
.l-main-section
:marked
## Add, Edit, Delete
### Add, edit, delete heroes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this ### instead of ##?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this introduces the fact that we will be adding support for those three features.
Each feature is then a section at level 2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This heading used to be directly tied to the order of the sections to follow (post, put, delete, and then a save section that combined the first two). Now I don't even see "post(" in the Dart page unless I select lib/hero_service.dart at the bottom of the page.

I think this rewrite needs some more connecting material, plus a careful review to make sure it includes everything it needs.

(Which reminds me... I noticed that some of the earlier samples got longer, so we need to also make sure that this page doesn't include anything unnecessary. /*...*/ can be a good thing, reducing complexity and scariness.)

@chalin chalin force-pushed the chalin-toh-6-hero-CUD-feature-silo-0822 branch from bafc01f to e8c33a2 Compare August 23, 2016 00:19
@chalin chalin force-pushed the chalin-toh-6-hero-CUD-feature-silo-0822 branch from e8c33a2 to 8c47c86 Compare August 23, 2016 16:33
@chalin
Copy link
Contributor Author

chalin commented Aug 23, 2016

@wardbell @Foxandxss @thelgevold: this is ready for TS-side review.

Please see original PR comment for a description of the simplifications that have been made.

I've squashed the post-Dart-review updates into the ts-only commit, so if you want, you can review only the TS-specific commit.

@Foxandxss
Copy link
Member

I like what I see but I will honestly prefer if @wardbell has a say on this too.

@chalin
Copy link
Contributor Author

chalin commented Aug 24, 2016

Elsewhere @thelgevold wrote: I think your edits look good, but let's wait for @wardbell's feedback.

@chalin chalin force-pushed the chalin-toh-6-hero-CUD-feature-silo-0822 branch from 8c47c86 to fc426b2 Compare August 24, 2016 22:24
@wardbell
Copy link
Contributor

I will review. I thought I could just skim it but there's more going on than I can grok in a few minutes.

Keep on me!

chalin and others added 3 commits August 26, 2016 13:21
Refactoring of "add, edit, delete heroes" section of toh-6 from one big
bottom-up step into small independent feature slices, where the user
achieves a "milesone" (i.e., can run the full app) after each feature
section. The section rewrite is shorter and offers a better UX.

Other simplifications:
- Error handling is consistent: in the hero service we log to the
console, everwhere else we just let errors bubble up.
- Hero service methods renamed based on function (create, update)
rather then lower-level implementation (post, put).
- @output properties have been eliminated (since they weren't
explained).

E2E tests now pass on both the TS and Dart sides.
Refactoring of "add, edit, delete heroes" section of toh-6 from one big
bottom-up step into small independent feature slices, where the user
achieves a "milesone" (i.e., can run the full app) after each feature
section. The section rewrite is shorter and offers a better UX.

Other simplifications:
- Error handling is consistent: in the hero service we log to the
console, everwhere else we just let errors bubble up.
- Hero service methods renamed based on function (create, update)
rather then lower-level implementation (post, put).
- @output properties have been eliminated (since they weren't
explained).

E2E tests now pass on both the TS and Dart sides.

Post-Dart-review updates included.
@wardbell wardbell force-pushed the chalin-toh-6-hero-CUD-feature-silo-0822 branch from fc426b2 to 391806d Compare August 26, 2016 21:31
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@wardbell
Copy link
Contributor

Add my tweaks. Merging.

@wardbell wardbell merged commit 907f848 into angular:master Aug 26, 2016
@wardbell wardbell deleted the chalin-toh-6-hero-CUD-feature-silo-0822 branch August 26, 2016 21:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants