Giter Site home page Giter Site logo

fewpjs-stitching-together-the-three-pillars-notredame-se-ds-preview's Introduction

Stitching Together the Three Pillars

Learning Goals

  • Identify the three essential pillars of front-end web programming
  • Cause a change to given code so that DOM updating effect is seen
  • Cause a change to given code so that server-side behavior is stubbed in
  • Cause a change to given code so that event listening has an effect

Introduction

Knowing what web programming is and how its elements work together conceptually is an essential first step, but in order to help orient our upcoming lessons, let's see it in action. In this lesson we've provided you a simple social media application called "Simple Liker." You'll see several posts which can be "liked" by clicking on the heart...well, they could be if the critical code hadn't been commented out. This lesson will guide you in uncommenting the critical code so that you restore the "like" functionality. In subsequent lessons, you'll learn the skills needed to create the pieces that you'll stitch together in this lesson.

Identify the Three Essential Pillars of Front-End Web Programming

We've introduced our three essential pillars of front-end web programming:

  • Manipulating the Document Object Model (DOM)
  • Recognizing JS events
  • Communication with the server

We also described the interaction that we want to make: "favoriting" an item on social media to turn an empty heart to red. Now, let's pull it all together and see how it works by walking through some code.

Cause a Change to Given Code So That DOM Updating Effect Is Seen

Meet our app, Simple Liker! It demos the favoriting action we've talked about and alerts you to what is happening at each step of the process. When all is working as it should, the action looks like this:

working example of favoriting a post

Go ahead and open up index.html in your browser and give the heart a click. Your experience will look something like this:

non-working example of favoriting a post

... which is, nothing happens. That's because we haven't switched on the working code yet. We're going to go through, step by step, find the code that makes each step work, and demo it to see how it looks in the browser.

Open up your demo.js file and take a look at everything there. Find the comments that begin with "Step 1." Follow the instructions there to un-comment the code that locates the page element we want โ€” in this case, the heart.

demonstration of un-commenting step one

Cause a Change to Given Code So That Server-Side Behavior Is Stubbed in

Next, in your demo.js file, find the comments describing Step 2, which sets up the mock server communication (our third pillar):

demonstration of un-commenting step two

Cause a Change to Given Code So That Event Listening Has an Effect

Now, find Step 3 in the commented code. It's time to bring in the second pillar, events:

demonstration of un-commenting step three

We've activated all the parts of our code that stitch in the three pillars of front-end web programming. Let's go back to your browser and see what Simple Liker looks like in action.

working example of favoriting a post

Conclusion

We're starting to see how the pieces work together now! Now we're ready to dive into the individual pillars and learn more about how each function. First, we take on manipulating the DOM.

View Stitching Together the Three Pillars on Learn.co and start learning to code for free.

fewpjs-stitching-together-the-three-pillars-notredame-se-ds-preview's People

Contributors

sgharms avatar aspenjames avatar jenmyers avatar

Watchers

James Cloos avatar Kevin McAlear avatar  avatar Mohawk Greene avatar Victoria Thevenot avatar Yoan Ante avatar Belinda Black avatar Bernard Mordan avatar raza jafri avatar  avatar Joe Cardarelli avatar The Learn Team avatar Sophie DeBenedetto avatar  avatar Antoin avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar Nicole Kroese  avatar Kaeland Chatman avatar Lisa Jiang avatar Vicki Aubin avatar Maxwell Benton avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.