Amanda Olsen

Front End Developer User Experience Enthusiast

Blog

Thoughts on the industry

Notes from DevNexus 2018

Attended my first DevNexus today (and yesterday). It was great! While it’s put on by the Atlanta Java Users Group (I believe), DevNexus is meant for all developers. It has good content for UI folks.

Below are notes from 3 of the 6 sessions I attended. These three were fantastic! Of the other three, two were pretty poor, and the third was too far outside my knowledge to be valuable to me, so I’m not posting notes from those. But the three below were absolutely worth my time. These notes are written with my mind in view, i.e. for me to review/understand later. If things don’t make sense to you, that’s why! And there’s likely typos, not my normal post.

Don’t Over React: Use Vue

installation

  • Recommends just using a scrip tag to include Vue
    • as opposed to npm install, etc

Coding

  • must define/locate a place in the DOM before you can begin work
  • (Why do so many developers like cats? WHAT is the relationship?)
  • HTML supports validation baked in… so I guess you don’t need JS for this? Very interesting.
  • supports components
  • Routing
  • Can just use Vue to replace basic jQuery interactivity in a page
    • so cool! It looked much easier.
    • Would need to run some comparisons about how much time is used to make certain functions.
  • What is VueX?
    • The store thing?
    • A litlte confused about what is a store is

More

A Skeptics Guide to Functional Style JavaScript

  • Jonathan Mills
  • “Practical Design Patterns in JavaScript”
    • his Pluralsite class
    • I think he considers this more important than Functional JS
    • I SHOULD go through this class
  • He went to Wikipedia to find out what “Functional JavaScript” is
    • It is a “programming paradigm” (a way of writing JS)
    • There is no such thing as “Functional JavaScript”
      • Instead what exists is “Functional Style Javascript”
    • Functional JavaScript says: side effects are evil!
    • “Tail Recursion is its own reward”
      • what is that?
  • But, he says
    • In JS you can’t avoid side effects
    • Not all functions can be pure
    • And not all things will be immutable. That’s how things work.
  • Functional Style JS is about using less brain power and making things easier.
    • It’s about making your life easier.
  • His proposed subtitle to this talk: Never write a for loop again
    • Can use a .map function instead
  • A function is pure if:
    • it returns the same value for the same input value all the time
    • and doesn’t do anything else
  • Should research the methods which run against array
    • ’cause there’s a whole bunch of them and they’re needed so often
    • Find ALL these methods: he HIGHLY recommended it
    • Your code will be so much more efficient
  • Currying
    • a series of functions?
  • Functions are just things
    • you can pass them around
  • Monads
    • Mondas are things that get around the “no side effects” rule.
    • He says “screw monads” because he DOES NOT CARE about the “no side effects” rule.
  • Functional Style JS
    • as you write a line a code, ask yourself “is this the simplest way of getting this done?
    • And at the same time, keep an eye on the big picture
    • FEEL FREE to have side effects. That’s kind of the point…
    • And to use less brainpower.

Write Better JavaScript with TDD

  • James Bender
  • Loves TDD
  • Tests usually get cut because they’re at the end
    • because usually at the end you’re pushed for time, so something has to go
  • The workflow should be
    • specifications -> tests -> code
  • Tests turn the specifications into a living/breathing piece of code
    • He usually has someone from the business verify his tests
    • The other benefit is: you become the first consumer/user of your code (i.e. does it meet the tests?)
  • Unit tests
    • should be isolated/independent
      • I don’t know what order the tester will run them in
      • So they should all be independent
    • Each test should test one thing at a time, not multiple
    • They need to be repeatedable
  • “I like to keep my code DRY but my tests kind of damp.”
    • There’s a time to repeat things
    • You don’t want to change your code to fit your test; you want the reverse
  • Red, Green, Refactor
    • Red – Start by writing a failing test.
    • Green – Write just enough code to make the test pass.
      • Code is ugly at this point.
      • I know the code works.
      • We’ve passed the worst-case scenario
    • Refactor – Optimize your code for readability, maintainability, and quality.
  • You want to be able to refactor as you go – things change over time! – this is normal and good
    • That’s why you want tests.
    • So that as you refactor you don’t worry about breaking previously-written stuff.
    • And so that as time passes, and you get further and further away from remembering what you were thinking when you first wrote the code, your tests will do the thinking for you.
  • Testing frameworks
    • Jasmine – set the bar for testing, and/or was the original one
      • Karma
    • Jest
      • Developed by Facebook React team
  • As you’re writing the tests, you write just enough code to make the test pass.
  • I really like BDD better than TDD
    • Would be GREAT for confirming I understand all specs in full AND for ensuring the business person does too AND for testing my code
      • Awesome
      • 3 great goals achieved in 1 step
    • Can embed “describe” blocks inside “describe” blocks
    • So… BDD is a set of best practices for writing tests (could be TDD)
  • Test each scenario AND its opposite
    • I.e. the condition and the negative condition
  • JavaScript is like the child in kitchen who is helping you but then makes a mess of the kitchen.
    • Or something like that…
    • He was referencing the fact that JavaScript is extremely flexible (and helpful!) but won’t stop you from doing dumb things.
  • Mocking
    • Mocking is hard (I think)
    • Sooooooo glad not to be using Angular – looks like a bit of a mess
      • React is way simpler
      • Qunit, on my app, is way easier than what he was showing.

Share your thoughts


7 − three =

Your email address will not be published.