Skip to content

Instantly share code, notes, and snippets.

@bad6e
Forked from rrgayhart/unit-testing-javascript.md
Last active December 8, 2015 18:48
Show Gist options
  • Save bad6e/bbce98a351745cc200b3 to your computer and use it in GitHub Desktop.
Save bad6e/bbce98a351745cc200b3 to your computer and use it in GitHub Desktop.

Step One: Watch Writing Testable JavaScript - Rebecca Murphey from Full Frontal 2012 (award for worst conference name ever?)

Step Two: Fork this gist.

Step Three: Respond to this question in your fork: Consider the four responsibilities that Rebecca lists for client side code (hint: they're color coded). Respond below with your thoughts. Did any of the responsibilities that she lists surprise you? Do you feel like you mentally split your client side code in IdeaBox and other past projects into these responsibilities?

I'll answer the latter question first - hell no. My CRUD applications take all the data in and so everything on it - in one big method. I like the first step of untagnling your code without writing massive document ready / event handlers to do everything. I also agree that it comes down to design.

Presentation: Data/Server: AJAX Application State: What is my app doing right now? Setup: Code that ties all pieces work together

I am confused about Application State. Isn't what my app is doing just a reflection of the server talking with the presentation?

Step Four: Totally Optional: take a look at some of the other forks and comment if the spirit moves you.

@rrgayhart
Copy link

Haha - I expected the answer to the last question to be some version of:
nope

My memory of the video is a little fuzzy, so feel free to ask me the Application State question in person, cause I don't know if I understood it reading it.

@rrgayhart
Copy link

I left this comment on Ryan's fork to explain my take on Application State - not sure if this is helpful to your question:

My memory of the video is a little fuzzy - but my understanding of Application State is keeping track of 'what has happened so far' - So thinking of when Steve did the exercise where a button triggered another button triggered another button, etc. 'A 'stateful' application records information about changes in state caused by events during a session, including those caused by user interaction' - So the state of the application encompasses the tracking of each button he clicks and having the respond with a new button, which has a new data attribute counting the number of clicks. When you refresh the page, you reset the state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment