10.02.2018

Clean up

You'd think JavaScript would only teach you fun things on a computer.  There is always that personality type that is drawn to fractal imagery and colors oozing into those pixels.  But what did I do this week?

Clean up your code, maybe clean up your life too?

When looking at code it is easy to keep adding more ifs, thats, when-whatevers to make it do unusual things.  But you know, I'm starting to equate this to a kid who took too many drugs at a music festival because they knew all the "right" people.  Those sporadic movements and otherworldly expressions start to lose meaning to the outside world, and thus a very internal pleasure.

While you mule over the phrase internal pleasure, let me tell you about my days off.  I've found that I have so little time during the week to accomplish anything for myself.  Then I look at my room, with clothes thrown around and objects that were stuffed in my pockets laid out on every elevated surface I could find.

I'm looking at it this way, yes my room serves a purpose to house me for a few hours of sleep and gives me tools necessary to change my appearance...but are those little crumpled receipts under the table, or the lone army of single socks growing in the alcoves affecting me?  Like, pieces of incomplete code or variables so ambiguous they start to play hide-and-seek with your mind.

These past two weeks I've invested time to organize.  It seems counter intuitive to have a clutter following around in your wake because one way or another you are going to have to deal with it.  Starting with my closet I put dividers IN my drawers.  My socks have a place, my underwear, my shirts organized by type, baskets containing scarves, and another bin for towels.  What breeze it has been to wake up and pull open a drawer and be like "ahh" like a Sprite commercial.  This is the only time I feel like Lebron.

Clearing the stuff lurking beyond the folds of my brain leaves refreshed spirit.  Instead of, wow my room I should clean it or wow this bathroom...what world did you emerge from?  It can be like, oh shit, I have to pay rent and clean up my code.

Whatever the deal is with how we think, we all reach a capacity.  Thoughts are energy and you only have so much.  So why not invest in not having to think about the mundane to make something brilliant?

I appreciate clean code as much as clean room.  I want that fluidity and fresh air in everything I do.

So here's the code I wrote previously.  To try and clean up each function I used the comments I made for their names.  I wanted three:

fish_turnaround();
background_grad();
fish_touch_sand();

I started off on the wrong foot and put the functions in set-up and would get an error:

But looking at the example we did in class, I was able to put the functions in set-up.  I'm guessing is that they were objects?  I looked at another classmate's example and they put their functions in draw so I tried that.

And eureka I got it to work!  Well, the first two functions.  Once I put the fish_touch_sand(); I got only the gradient screen.  Which confuses me.  The other two work fine on their own...am I missing something?


I commented out the background command and found where my things were hiding...sorta




Haha, just fixed it.  Go me, real time troubleshooting:


Order matters!  Organize Organize Organize.

No comments: