Snap out of it!

Aug 30, 2016 12:18

Feeling a bit tired and lazy today. I'm not sure why, as I woke up ten minutes before the alarm this morning and at the time was fine with it. I guess lazy really isn't the right term: more like restless. I don't mind doing language tutorials, but I'm being more easily distracted than usual. At least I can hunker down and get this entry finished, and it's one thing marked off the to-do list.

I'm finding the html/css tutorials on Codecademy much more pleasant and informative than the one over at FreeCodeCamp. I've been doing html for ages, but CSS is relatively new to me, and Codecademy has a nice selection of small mini-projects that makes CSS seem so much friendlier. I think part of FCC's problem is that they blur the lines between CSS and Bootstrap almost immediately. I only figured out today that Bootstrap is a framework for CSS, not a type of extension of it. FCC is big on mobile app development, but I don't think I understood or appreciated that when I started using the site. I do want to learn how to use Bootstrap in that context, but it would have been so less frustrating had I known at the time that building confidence in my CSS skills was not implicitly contingent on making it work with Bootstrap. Now that I'm running the CSS tutorials at Codecademy<, I am able to look back over my first web page project from FCC and see why it wasn't such a p.i.t.a. and why I wasn't getting the results I wanted. Maybe once I get it resorted I'll release my Richard Ayoade Fan Page on the world! (Or maybe not. It will need a lot of reworking not to look like it wasn't make on an Angelfire site in the 90s.) But at least I'm learning.

Yesterday's note-taking

Tip #32: Crash early.
Tip #33: If it can't happen use assertions to ensure that it wont.
Tip #34: Use exceptions for exceptional problems.



All errors give you information.

Dead Programs Tell No Lies

When your code discovers that something that was supposed to be impossible just happened, your program is no long viable. Anything it does from this point forward is suspect, so terminate it as soon as possible.

"There is luxury in self-reproach. When we blame ourselves we feel no one else has a right to blame us." -- Oscar Wilde, The Picture of Dorian Grey

Assertive Programming
  • Whenever you think "this will never happen" add code to check it.
  • Boolean assertion: (String != null);
  • Leave assertions on
    1. Testing doesn't find all bugs
    2. Code runs in the real world
  • Make sure assertions do not change your code/create new errors



Watch out for Heisenbugs!

Exception v. Error Returns
  • Exceptions are warranted when something unexpected happens. If something happens but it is not exceptional (file doesn't exist but you weren't certain it did), an error return is more appropriate.
  • Exceptions represent an immediate non-local transfer of control. Programs that use exceptions as part of normal processing suffer from all the readability and maintainability problems of classic spaghetti code, breaking encapsulation, with routine and callers more tightly coupled via exception handling.


codecademy, pp_tips, css, freecodecamp

Previous post Next post
Up