The Javascript ES2015 spec introduces object destructing. Object destructing used to pass a single object parameter instead of long argument lists to functions. Take the following code example.
Bad Code:
function enableListFilter(option, filterName, filterIndex, activeAccessTypeIndex) { // Do Something}enableListFilter(option, filterName, filterIndex, activeAccessTypeIndex);
The function requires the developer to know the order of the parameters passed into the function.
When this is one argument, that’s easy.
When it gets to 2 or more arguments, this can get difficult since that stretches a developer’s working memory a la “yet another thing to remember”.
Here’s an alternative.
Better Code:
function enableListFilter({ option, filterName, filterIndex, activeAccessTypeIndex }) { // Do Something}enableListFilter({ option: option, filterName: filterName, filterIndex: filterIndex, activeAccessTypeIndex: activeAccessTypeIndex});
If you want to reduce the number of lines, you can use the object parameter shorthand.
Note: A caveat of this approach your argument names must be the same name.
In most cases, an explicit approach of writing out object keys is better.
Beyond the pagoda decorated with oriental lanterns and stone lions, is a center of Asian-American culture and identity. A common immigrant experience is to make the new home feel less foreign. For the Chinese and other Asian immigrants, that space is Chinatown.
Generations of Discrimination
My grandfather spent his early adulthood in San Francisco Chinatown. It was the 1930’s, and discrimination was rampant. My guess is he was assigned by the Chinese Chamber of Commerce his first job in San Francisco Chinatown. Or perhaps it was his father. Nevertheless, the chamber had their hand directly or indirectly because they helped find employment for most incoming immigrants. The Chamber acted as a gateway because new immigrants weren’t immersed in American culture or language, and during my grandfather’s time, there was rampant discrimination. 8 decades later, the Chamber remains to help. When founded, the Chamber was run by Chinese, for Chinese. Today, it’s expanded to more Asian communities.
While I’m hazy as to how my grandfather got his first job, I know his job was to help run a laundromat. He worked there until the war broke out. He did his duty and fought the Asian Pacific front. When he came back, he courted my grandmother and married her. With the help of the GI Bill, he was able to buy a house in Berkeley. They had four kids, all boys. One of them is my father. By all means, they made their American dream.
My dad and his siblings grew up in that Berkeley house. They grew up under the strict and regimented rule of my grandfather. My grandfather’s kids children weren’t quite keen on the rules. As children do, they rebelled, but not well. As much as my father wouldn’t want to be compared to his father’s flaws, I see this behavior passed on my dad. He gets anal about tiny details that I don’t think matter.
My dad still faced the discrimination in the 50’s and early 60’s. He recalled to me how the grocery store he stops at today didn’t allow him to enter when he was a kid. “No colors” a sign read marked at the front of the store. The tide changed in his early adulthood.
The dirty secret of immigrant communities is they discriminate. During my grandfather’s adulthood, the Chinese community discriminated against anyone who wasn’t Chinese. My grandfather rejected the idea he or any of his children would marry a Japanese woman. From the war, his discrimination grew larger. I’m sure he was livid when one of his sons married a Japanese woman. That was my parent’s generational divide with their parent’s generation. Today, my divide comes in other arenas, like sexual discrimination. I’m much more tolerant of the LGBT community than my parents. It’s not as harsh as my grandfather’s hatred towards the Japanese. Their discriminatory behavior comes from a lack of knowledge. And that becomes a learning opportunity when I speak to them about those things, if of course you can teach old people new tricks.
Chinese Yesterday, Muslims Today
Muslim communities are discriminated like the my grandfather’s Chinese community. Political tensions with China were high with the rise of Mao Zedong. Chinese restaurants were in the tank because the community marked them as a communist symbol. The community didn’t understand not all Chinese were communists. They failed to understand many of them were Nationals and pro-Capitalists. My grandfather was an anti-communist, and agreed with the economic beliefs of the community.Yet, like every other Chinese business, he was fighting to win the respect of his surrounding community.
Today, political tensions are high in the Middle East. In the Midwest, non-Muslim mothers are scared to have their kid play in a playground because they don’t trust the muslims in their community. It was a point of contention in a recent episode of This American Life. Trump caught wind of this and blew it out of proportion, calling for a temporary ban on all Muslim immigrants. Trump undermines the real point. The issue has more to do with the divide between communities.
My grandfather opened his own laundromats after the war. He was able to sustain customers by doing business with everyone, even the people who didn’t like Chinese people. Tensions came down when they saw my grandfather as the average Joe trying to make a living. They connected with him by talking to him on a regular basis. And he did a damn fine job with their laundry.
I have this itch that we, as a collective, no longer talk with one another. The communities with such rising tension do not connect on empathetic levels. The headlines flood us with asserting blame on the growing immigrant population when really, we never took the time to interact. My call of action is to interact with people you don’t agree with. Try to understand where they are coming from, and understand circumstances are different.
Coda
I’m writing to you from London/Gatwick airport returning from holiday. From the last few days I was here, I noticed good portion of service-oriented business is run by immigrants. After a few conversations with locals about Brexit, I noticed some alarming parallels. Some politicians have convinced the country immigration is the issue rather than pointing out the harder question of the economy. My guess is it’s easier to scapegoat immigrants and play off this sentiment with the citizens. Again, my belief is communication is key for dissuading this argument.
Conclusion
My grandfather passed away before my first birthday. I wish I knew him more. I really want to have a conversation with him. Maybe about being an immigrant. More importantly, how he was able to convince people around him he was an American, assimilated. How he could operate a business with customers judging his allegiance to capitalism. But that won’t happen, and I can merely speculate. So the best I could do was scrap this together through second hand accounts, photographs, and letters.
I know a conversation is a start, and let’s continue this from now on. Tell me your immigrant story. Change my view on how I look at other cultures. The advice is concrete because the issues span generations.
Beginning this year, I steered in a film adventure. It started with Mark Cousin’s documentary series, “The Story of Film”. It’s a 15 hour spectacle taking you around the world to learn about film history. Though there are sections where the focus is on Hollywood, it doesn’t linger there too long. Cousins talks about film as a global language. Starting from the beginning of film with the Lumière brothers, Cousins works his way through the silent era but relates it to modern day cinema. As a viewer, you’re taken back and forth through films of different eras, understanding how one generation of film makers borrows from the film language of a previous era.
The series had a profound effect on me. Being able to see people make film from a hundred years ago and more tells me there are commonalities in human behavior and events that cross generation and millennia. I had a similar revelation when studying art history, though that was not as profound because the interpretations of the art were typically from secondary or tertiary sources. In film, there are primary sources from documentarians interviewing directors and cast members. For example, MoMA exhibits Van Gogh paintings, but its descriptions are written by the art curator. As an extra on the Blu-ray of Stagecoach, you can watch an interview with John Ford talking about directing his film.
Aging Film Stock
Thanks to recommendations from some readers, I checked out the Stanford Theatre. I don’t know why I hadn’t gone sooner. I watched “The Blue Angel” from 1930. The film shows its age with the crackles and pops from the audio and dust and scratches on the film. I couldn’t care less. I was invested in the eventual downfall of the professor. I was taken aback by of Lola’s song as a harbinger. I witnessed a screening uncommon for today.
While the majority of this year has been watching restorations, original prints or something close to it is just as important. The Stanford Theatre showed me the value of old film. It’s the living print that has been stored for decades before and will continue to be our go-to until we can restore prints to the highest quality. That definition might be the highest pixel density you can get before there is no discernible detail in the film grain.
Thank goodness there are film preservationist keeping these films alive. Preserving the reels is a tough job. This is worse for film with ammonium nitrate that’s highly combustible, prevalent in film before the 1940s. Some films are lost forever because of neglect from the studios, archive fires, and other damage.
What’s Next for Film?
Despite digital taking over, film still has a place in our world. The latest Star Wars film was shot partially on film to give it the aesthetic of the original trilogy. Tarantino swears by it because he believes it gives that bit of authenticity to movies. Is it enough to keep this medium alive? I wouldn’t know. I’m not in that industry. But I will appreciate film for what it’s worth, if it means going to events at Stanford Theatre, SF MoMA, and Berkeley Art Music and Pacific Film Archive. I love this experience of film and would love if everyone could go watch.
I am coming forward; I glance at my phone during dinner conversations. I glance at my phone to check for notifications. I glance at my phone to check the time. I glance at my phone to preview a text.
Is it rude? Yes. However, I can argue that it depends on circumstance. If there’s a matter more pressing or urgent, the action is warranted. But try to be mindful by letting others know. I make the matter its own event and leave the conversation, i.e. a context switch. I don’t want someone to see me disconnected or disengaged in our conversation. An in-person conversation is dialog that belongs to the participants, not to the outside triggers of life.
I have been experimenting with myself by leaving my phone away from reach when I’m talking to someone. If I’m having a coffee shop chatting with a friend, I’ll leave the phone in my bag. If I have friends over for dinner, I leave it on a counter top where I won’t check it.
The exception is when the phone is the conversational centerpiece. If you want to show something on your phone, then it’s not rude.
The Longer Version
I have a tough time reflecting on ideas that I’ve read. It’s easy for me to read things to learn, but if I were to take a step further and apply what I’ve learned, I become stuck. That’s why this is the fifth time I started writing an essay about Sherry Turkle’s new book, “Reclaiming Compassion”. Each past reflection was a step closer to finding out how Mrs. Turkle’s book applied to my life. I identified the book applies to three areas of my life — my work, my relationships, and my personal life through notifications.
Let’s take a step back. Turkle’s book discusses the shortcomings of communication with our new technology. These shortcomings focus around modifying our behavior that ends up distancing us. The book uses case studies and interviews to demonstrate the main points.
Work
One case reviews new paralegals using email as a primary mode of communication. These employees prefer email over face to face interaction to their boss and the firm’s clients. Before, paralegals booked face-to-face meetings and talk about their client’s cases in person. After reviewing work performance of some NY firms, there were lots more miscommunication between firm and client. (need to review the effects). A few firms recognized this and forced their paralegals to make contact in person. Within a few months, these firms noticed an uptick with client satisfaction.
Thinking about my company, we use an IM service for work. I have found it far easier to IM my boss than to walk over to him and ask a question. The relationship was established prior that he can be asked questions in person, but for the first few months of my job, I preferred to ping him my questions. Then I realized there’s more to learn through a face-to-face interaction, so I’ve asked him more questions. When he’s busy on something else, he’ll let me know he needs a minute.
Further than that, if there are logistic issues between my co-worker and I, I will initiate a conversation in person or a video chat over resolving the issue over chat. When I’ve applied the latter, more effort is used to re-explain many times my point of view. If there’s a highly technical logical issue I know would be better through text, or more likely, images, then I’ll do that. Emails get flooded and many times, it’s hard to respond to everything. But more on that later.
Relationships
The book also examines texting in romantic relationships. Mrs. Turkle talks to a teenage boy about his first relationship. The teen wanted the appearance the relationship mattered, so when she texted him, he made sure he responded immediately. More than that, he would stare at his response for a while to make sure it sounded right. He took advantage of the editing capability of texting. However, when he met with her in real life, he was scared he might say the wrong thing. Sometimes, the girlfriend didn’t want to remarks of her admirable abilities the boy kept making. Because it’s hard to convey annoyance by texting, the girlfriend would respond negatively. This would devastate the teen, so he would text her non-stop trying to re-write his wrong. In the end, the relationship didn’t work. The teen was confused and hurt, unsure what he had done wrong. After examining this with Mrs. Turkle, he starts to see his errors, but he’s unsure if he can escape the anxiety of each texts on the next partner.
I can relate to this teenager. I have found myself editing my texts to my past partners to sound better than something I can come up with on the spot. I don’t have problems in conversation. I have an issue with flirting through texts than expending energy to quality time, the need I have the most in terms of the Five Love Languages. [1] My aim with my partner is to focus on that need and spend less time focusing on making myself sound more interesting through texts. Besides, I love flirting.
Notifications
Notifications pierce through our attention span and jump to the front of our todo list. Turkle’s book examines the consequences of constantly being bombarded by alerts. Her findings don’t look so good. When we get a text message, many of us will drop what we’re doing and read it. Of the many, the majority will respond to that text right away, even in midst of doing a different task. In other words, when we are talking to someone and receive a text message, few of us will stop that conversation and glance at our phone. Even fewer of us will respond to that text message than to continue to carry the conversation we are already having.
I get bombarded by emails, texts, and other phone notifications. Desktop notifications have slowly crept up too. I am okay with not responding to a notification at ping time, but I have a hard time forgetting about it when I’m notified. My solution is to silent those notifications, if not removing them entirely. I removed most of my app’s notifications except for texts. I will silence my texts during work hours and leave my phone away from me once I get home. I know for the rare chance there’s an emergency, there will be a phone call rather than a text. As for when I respond to texts, it’s whenever I have time to dedicate during the day to do it. Typically, that will be when I run out of steam at work and need a break, which is around 3pm. At home, I can check it after dinner. I have found I don’t sleep well if I text right before bed.
Attention
Turkle talks about this case between parent and child. A mother might be worried about how much time her daughter is spending on the phone. However, the mother takes emails and texts during dinner time, and the daughter tells the mother to get off her phone. Children emulate the behavior parents display. If parents don’t change their behavior, it’s hard to imagine this mother changing her daughter’s behavior.
I don’t have children, but I make it a point when I’m out with my friends to check my phone as little as possible. I recognize the moment I see the phone in sight, I have an uneasy feeling I am battling for their attention. Also, I recognize when I don’t know something that comes up during conversation, I should ask others and not try to check my phone. If all participants don’t know the answer, I still should not find the answer because I know I can’t control myself to continue to browse the Internet after I have found the answer. And I know the other person or persons in the conversation will feel left out, per the point I made in the beginning of this paragraph.
Closing thoughts
This week, I crossed my 50 day mark of meditation.[1] It isn’t 50 consecutive days, but I still see the effects it had on me. I feel closer to my body than I have before and I’ve reduced my general anxiety. One of the things therapy helped with in my past is recognizing when my body tenses u during stressful situations. I have not been practicing that behavior as much until I started meditating again, and now I recognize the internal battle I’ve been struggling with everyday. Mrs. Turkle’s book shined light on some other areas that weren’t apparent to me I might also be struggling with. Not every case she wrote about applies to my life, but of the number that did and wrote about here, I have some action steps I’d like to try out. I know I might not be successful with some of my initiatives, and that’s okay. If I didn’t try, that would result in how I’ve approached self-help books in the past. The advice is sound, but because I have no action in place to change my behavior, I continue to fall into my own traps.
[1] Since writing this piece, I have stopped meditating. I crossed 60 days and stopped when I went on my trip to Thailand.
People who run marathons are sadistic. The feet wear down after a dozen or two dozen miles. Full recovery takes a days. Mental capacity gets beat up. Hunger sets in. To say at the very least, this was my state on Sunday. And I’m saying I’m sadistic.
You think after my first marathon, I wouldn’t run again. Despite the critics, I threw myself back in the pool.
Critic: “Why would you pay to run?”
The event is an incentive to get in shape. I dragged myself on extended runs because paid to participate.
Critic: “But why? You could run on your own?”
I guess so, but I like running in large groups. Plus, I like being catered to by marathon volunteers. In this event, that includes the police.
After the run, I love getting small ego boosts when I tell someone I ran the San Francisco marathon. I get an extra boost when they told me how much of an accomplishment that is. I admit, I’m shallow.
Critic: “Are you crazy?”
You should have asked me that the first time around.
The SF marathon is held annually. This year, 27,000 runners took the marathon challenge. I feel proud to have finished under the time limit. But I feel like crap that I made some rookie mistakes. Please don’t make these mistakes.
Run faster than your training pace.
I thought my pace was 11 min per miles. It’s not. I found out my Fitbit can’t measure distance when my strike width is smaller than normal. That difference meant my time was longer than 11 min per mile. Of course, if I only use my Fitbit to pace, that doesn’t matter because the references would be the same. But here’s the kicker; I was still running faster than my “training pace”. I screwed up big time and felt miserable by mile 11. Also, I was surprised I was only at mile 11 when I got to that mile marker.
Run together, alone. Initially, I ran with my earbuds. For 13 miles, I thought I could drown the pain out with music. Not the case at all. I stopped more often with my earbuds in than without. After mile 15, I was about to find at least one chatting partner until the end of the race. I feel grateful to run into chatty folks. They helped me keep a running pace. Also, after I took off the earbuds, I heard a ringing in my ears after. Don’t listen to music too loud!
Train on an irregular schedule. In addition to running, I was also doing gymnastics strength training. Instead of focusing on running a few miles a day, I took more time contorting myself in strange positions. I couldn’t keep a good routine going during my 2 and a half months of training. My legs paid the price.
Run with worn out shoes. I used the same shoes from my first race. 8 months ago. Please don’t do that. My feet hurt unevenly. The right foot hurt more than the left. The traction was all gone. The padding was worn in. For a short distance, that’s fine. For a long distance, it can lead to terrible injuries.
Don’t pack snacks. I needed an extra snack after my stomach gave way. I left an extra Clif bar in my car and completely regret it at the halfway point. The tail-gaters parked close to the finish line were terrible people. I could have slugged one of them in the face if I had the energy to do it.
Take many caffeine shots. The gel packs are a great boost, but use them sparingly. It turns out they give me cramps. That’s extremely unforgiving when I need to sustain a steady pace. I had a really bad muscle cramp towards the 3rd quarter that I shook it off by running more. It came back in the end when I tried to sprint through the last 0.2 miles.
Now that it’s all said and done, I’m glad I ran again. I got to meet people from all over. I got to suffer with people from all over. I got a lot of cheers from all over.
Someone in the race told me, “Not everyone can do this, you know.” She’s right. Not everyone can run a full marathon. But, you’ll never know if you don’t try. I put myself in the arena, and I hope this is your invocation to begin.
As part of National Day of Civic Hacking 2016, we formed a team that created a virtual reality prototype to enable the public to better learn about the Zika virus – the nature of the pathogen, its health consequences, potential breeding grounds of Zika infected mosquitos, and effective Zika prevention techniques.
The dark masks a new moon as we continue down the streets of Charleston. The tour guide walks us to the entrance of an alleyway. The iron-rot entrance gate is shut and pad-locked.
“Behind this gate is a narrow alleyway leading to the Utilitarian Church’s cemetery,” said the tour guide. “The church locks the gates in the evening to keep out trespassers. I’ll tell you why when we circle around the corner.”
We follow the guide to a small parking lot past an antiques store.
“Just over these walls is the aforementioned cemetery.” The guide points at the 8 foot high cobblestone wall. “Years ago, that gate was not locked and was opened to the public at all hours. That is, until the antiques dealer stumbled through it late one night. You see, he was working late, passed midnight. He didn’t notice the time pass, baffled when he locked at his watch. He gathered his things and decided the alleyway would be a faster route to his car. He had never walked in the alleyway this late at night before.
He locks up his shop and walks down this alleyway. About halfway, he notices a grave mistake. There are no lights; it’s pitch dark.”
The group looks around. There are street lights all around us illuminating the area.
“These lights you see today were installed a few years ago,” the guide continued. “This incident occurred two and a half decades ago. Folks, I assure you, the path was dark.
Not too sure where the dealer was going, he stumbled on a few headstones. Suddenly, he saw a lady in a wedding dress.
‘Excuse me,’ he says, ‘do you know a way out of here?’.
The lady gestures to follow her. Without giving it much thought, the dealer obliges. He thought this woman was peculiar with this eerie glowing presence. She walked into a tree and disappears. The dealer is in shock and runs back the way he came. He runs out of the gate and takes the longer route to his car, swearing never to go through the cemetery again.
The next day, he tells his friends about the encounter. Some people are intrigued by the ghost and try to retrace his steps in finding the woman in the wedding dress. After one too many trespassers, the church got annoyed by the attraction, so they decided to lock the gate. This barred people from entering. As you can see here, no one was going to go around and climb the 8 foot high cobblestone walls.
On one particular night, for whatever reason, the church forgets to lock the doors. A pedestrian decides to see what’s beyond the gate and discovers the woman in the white dress. He calls out to her, but she doesn’t respond. Like the antiques dealer, he sees her disappear into the tree.
The next morning, the man returned to the cemetery but found no grave near this tree. From the description these two men gave, we don’t think this is the ghost of the serial killer. We believe this was Miss Annabel Lee.
It’s the 1820’s. Annabel was a frail young woman who fell in love with a sailor. Because the parents disapproved of this courtship, they would meet every night in the cemetery under this tree. Before the sailor was sent off to duty, he promised he would marry her when he returned. Sadly, Annabel died of yellow fever. On her deathbed, she asked her parents to be buried in a wedding dress. They obliged and buried her somewhere. The area she was buried was never marked, so we don’t know where the grave is. It would take a few months later for the sailor to find out, and he was totally devastated.
Edgar Allan Poe wrote about Annabel in his last poem. He named it after her, “Annabel Lee”. A few months after publishing the poem, he died.”
Then, the guide tells us something unbelievable.
“The reason I think Edgar Allen Poe wrote about Annabel is he was the sailor. The timing checks out. He spent time in Charleston in the 1820’s. He was in the navy before he was married. And most evident was how grim he looked after his time in the Navy. Check out his before and after picture.”
The tour guide holds up his iPad and shows a side by side comparison of Edgar Allan Poe as a sailor and much later after becoming famous.
Edgar Allan Poe in the NavyEdgar Allan Poe later life
We left that spot and continued the tour, but I was left wondering if the legend is true. I did an Internet search last week with very inconclusive results. I don’t think the truth matters though. It got me to think about fabricating reason to the supernatural, and how it tells a compelling story. If the truth were uncovered, I think the story would be mundane and boring. At least this way, we can put a reason to Edgar Allan Poe’s grim face.
Alas, I’ll stop it with the ghost stories. If you enjoyed this, go check out Charleston or Savannah for yourself. Take the ghost tour and decide if the ghosts are real. Or just listen to some great stories about these city’s pasts. They have some great storytellers.
I went on a ghost tour in downtown Charleston where the tour guide told us real ghost stories. His stories were enlivened because we would bear witness to the sighting locations.
First, the tour guide introduced us to the ghost in the jail house. Over a century ago, a confederate prisoner occupied a prison cell in this jail house. One night, he heard footsteps down the hall. It was late so the prisoner thought it was a guard. When he looked up, he saw a woman in a white dress. He felt a chill as she walked passed his cell, laughing hysterically. Years later, the prisoner writes the experience was more horrifying than the dead bothers lost in battles.
The jail closed down and was abandoned for decades. In the early 90’s, a tour guide stumbled into the space and decided he should tell ghosts stories there. He started a ghost tour service and saw business boom. One late night, after telling his ghost story, he broke horror movie rule number 1: Don’t wander off alone. He walked down a long corridor saw a women in a white dress. He shined a light at her asking if she was lost. She smiled at him and walked into the wall. He was taken back and ran off. The next day he resigned from his tour business.
Who was this lady? The tour guide believes she was a serial killer from the colonial days. Her husband and she killed over 30 people. They were captured and sentenced to death. After the beheadings, her body mysteriously disappeared. Perhaps she’s haunting the jail house because no one knows where her body is.
In my quest in developing my data visualization skills, I’m finding validation to be a common interdisciplinary concept. For example, in music, you validate hitting the right notes, keeping beat, and listening to your pitch. In engineering problems, you validate theoretical calculations with empirical data. In business, you validate the business needs with return of investment calculations and customer satisfaction with surveys or field studies. In relationships, we’re validating our perception of the other person. Along the way, when we forget to validate our performance, assumptions, or perceptions, we falter. We play a terrible piano recital. We cause downstream problems in the production line. We take a loss in next quarter’s revenue. We begin to distance ourselves from who we love.
We can classify validation as passive and active. Passive validation is when we gain validation without expecting it. A core essential of validation is feedback loops. Feedback loops are outcomes of validations that when triggered, feed back to the process. Test driven development embraces this by having the developer write tests before code. The rule of thumb is “red, green, refactor”. Red refers to running the test and seeing it fail. Typically, when tests fail, the printed output is red. Green means to write code and see if the tests pass. Typically, passing tests are printed green. Refactor means trying to make that code you just wrote more robust. “Could this piece of code be written better.” Because you already wrote the test, and the code you wrote works, refactoring does not harm. In fact, if your refactored code does not work, the test will give you feedback, invalidating your new code. At that point, you can revert back to the old code.
Active validation requires an effort to test our perceptions. In my data visualization journey, I’m learning how validation works at each level of the process. At the top level, a visual designer asserts the problems of a target user and determines if this problem is best supported with a visualization tool. As a developer, I find myself missing this step of domain validation. Jumping straight to code before thinking about the end user is a smell of disaster. You may be solving the wrong problem or generating a new problem for the user. The old adage that more technology is better is not true. It reminds me of the film, “This Is Spinal Tap” where one of the band members shows the documentarian that his amp goes to 11. The documentarian asks, “Why don’t you just make ten louder and make ten be the top number and make that a little louder?” The band member replies, “These go to eleven.” Building tools for the tool’s sake is missing the mark.
I hate to admit it, but I find myself relying on intuition rather than verification. It takes energy to validate your intuition. But while this may be a short-term loss, it’s a long-term gain, and humans find it hard to perceive long-term gains. This is where awareness can come in handy. Without awareness, we can let confirmation bias get the better of us. Confirmation bias is the fallacy of using purely coincidental evidence to confirm our intuition. With a heightened awareness, we force ourselves to realize we’re making a confirmation bias, and we must validate what we are thinking. Here’s an example. Why do some voters want Trump to be the next president of the US? I find this question really difficult to answer. I’m not a Trump supporter, so I made my own hypotheses. But, I haven’t talked to a single Trump supporter, so my hypotheses will not get validated. Having awareness means while I think I know what’s going on, I don’t have the slightest clue, and I’m painfully aware of that fact. If I wanted to know, I’d go to a Trump rally, interview some of the supporters, look at polls and surveys on the demographics of the voters, and ask experts.
Validation applies to teams. In a production line, you want to decrease your batch size and intervals of work. At each stage, there are feedback loops that validate whether each batch is valid. The result is an increase flow in production. When I was manufacturing stents, each batch size was small enough where we would only sample 5 to 10 parts per each stage of the process. Of course, final quality assurance checks 100% at the very end. If the parts were invalid at a stage, the batch would be removed from the production line and another batch would be added to the production line. The outcome was a faster output and better worker satisfaction. When you don’t have checks at each stage, errors get downstream, meaning a bad batch would waste time in production because you wouldn’t find out until the final quality assurance checkpoint.
Here’s an action to takeaway. Find one problem you’re repeatedly doing. Propose a solution to that problem. Purposely try to make that problem happen again. If it doesn’t happen, you’ve properly validated your solution. If not, propose another solution and try again.
Footnotes
The Pragmatic Programmer is full of tips like “Coding ain’t done until all the tests run”.
“Red, Green, Refactor” is a corollary to this.
Although I only brushed over the top level, there are three other levels.
Tamara Munzner writes in her textbook, Visual Analysis and Design, about the four types of validation.
They are domain validation, abstraction validation, idiom validation, and algorithm validation.
Abstraction validation is testing the translation between domain terms and visual data terms.
Idiom validation is testing the right tool for the right job.
Algorithm validation is benchmarking the algorithms and determining if they’re performant.
The production line example is loosely taken from the three ways described in the book,
“The Phoenix Project”,
which describes software and dev-ops as a production line.
It’s worth a read if you’re in software and you’re having issues in your team’s pipeline.
I repeat the same pattern every few months. I’ll stop being productive on personal projects. I’ll replace it with an obsession, and it takes over my life for the next few weeks. It’s great if the obsession promotes healthy living, like marathon training or yoga. But this past month, it was an obsession with film.
And I mixed this obsession with the feeling of guilt. Every week, I see the task of writing this newsletter. And every week, I follow the same routine. Monday comes and Monday goes. Tuesday morning, I feel guilty I let my readers down. Rinse and repeat the next week.
The obsession began when I started watching a documentary series called “The Story of Film: An Odyssey”. It was a 15 hour series chronicling world cinema since its inception to the early 2000s. About halfway through, I wanted to watch many of the films mentioned. That’s when I found the Criterion Collection. Or rather, re-discovered. I knew about Criterion through their collaboration with Hulu. I thought they were a collection of American films. But it’s much, much more. The Criterion Collection includes films from around the world that cover nearly all decades of film. I was determined to watch some of them and own a few.
On my little journey, I learned most physical Criterion discs include supplemental material, booklets, and books. I also learned about their restoration process for old films, learning there’s an art in film preservation and that we’ve lost many great films over the years. I also learned of their custom artwork for their covers. What I’m trying to say is, I learned about Criterion’s brand. I feel in love with their brand because of this attention to detail. Loyal fans of criterion will speak highly of these things. It almost feels like an Apple cult-like level. I was determined to buy one to see what the big hype was.
Not wanting to pay for such expensive media, I found my local used records and movie store. I hadn’t been there before. When I stepped in, I remembered why I like these stores. I lost myself in the sea of aisles scanning through albums I’ll never listen to. I get excited wondering why someone purchased this record in the first place. Nested behind the soundtracks were an entire section dedicated to Criterions. I was amazed at the selection. I walked away with “Spartacus” and “High and Low”, a Kubrick film and a Kurosawa film. I was not disappointed.
For the next few weeks, I found myself pouring through the collection, either renting some of the films from the library, watching them on Hulu, or binging on the sale from late last month. I found myself collecting films I wouldn’t have watched a few months ago. Silent films? Yes. Foreign Italian films from the neorealist era? Check. I now feel more adept at hearing film director’s names and reciting one of their films.
Tonight, I’m watching Persona from Bergman. 7 minutes in and I know I’m in for a treat. But I must still make time for writing. Writing grounds me not to stray too far away in this little obsessions of mine. The time I spend writing this newsletter has paid back in helping me understand myself better. Today, I feel more confident about writing again. The truth is I felt like I lost my way with writing during the end of January. I sunk myself in film, and now I feel refreshed, ready to talk about some pending items I have in store. In a way, film restored my writing. Watching these directors at the height of their craft really inspires me to lose myself in creativity. So, let us begin another few months of newsletter goodness. I know I’ll enjoy it.
Tonight was the end of my dodgeball season. Here’s a quick list of lessons learned. Some lessons translate to business. Some translate to personal progress.
It’s not about the individual effort, it’s about the team effort.
When you’re the lone dodger out there, you’re team will still be yelling at you.
I’ve been a Javascript developer for the past year and a half. By reading the “You don’t Know Javascript” series, I’m hoping to hone my vanilla Javascript skills and have a deeper knowledge of the language.
In Up & Going, I’m hoping to review the basics and understand more deeply why the language has the set of tools it has, and perhaps a deeper understanding of why we write Javascript the way we do.
When you strive to comprehend your code, you create better work and become better at what you do.
Preface
This You Don’t Know JavaScript book series offers a contrary challenge: learn and deeply understand all of JavaScript, even and especially “The Tough Parts”.
I like this attitude as it focuses on the bits of the language I have to deal with time and time again. It helps me understand the behavior of Javascript without blindly looking at a TypeError with a quizzical expression.
i.e. Cut out the buzzwords. Learn the language
Chapter 1: Into Programming
Explains programming at a high level. I may skip large sections of this.
literal value are values that are itself and are not stored. e.g. in the statement, y = x + 4;, 4 is a literal value.
Expressions are the reference to variables, values, or set of variable(s) and value(s) combined with operators.
Assignment expressions assign a variable to another expression
I’m reviewing this because these basic building blocks can be fundamentally different. In Go, assignments can be completely different
Review later: Javascript compiling in the first two chapters of Scope & Closures
The prompt() function opens an alert with an input. You can assign the function with a variable. age = prompt("What is your age?");
We take it for granted that specifying the variable in an assignment is typically on the left.
Side tangent: Are there languages that do the opposite?
Some lesser known assignments in JS include
Remainder assignment x %= y
Shift assignments x <<= y
Shift bits left or right by a certain amount. The above example shifts bits to the left.
Bitwise assignments x &= y or x = x & y
The above example pertains to bits, using an AND logic.
AND logic table
Bit
Bit
Result
0
0
0
1
0
0
0
1
0
1
1
1
values added to the source code are called literals
Implicit coersion is when you’re making a comparison against two different types. The == operation is ‘loosely equal’ and uses implicit coersion. For this reason, it should be avoided because it can cause unexpected bugs.
More on this later in Chapter 2 of this title & Chapter 4 of Types & Grammar
Code comments help other humans understand your code. It’s a communication point.
Comments should explain why, not what. They can optionally explain how if that’s particularly confusing.
Note to self - focus on why, and less on what.
Static Typing - variables adhere to type enforcement
Dynamic Typing - allows a variable to represent a value regardless of type. Javascript adheres to this.
State is tracking changes to values as the program runs. In redux, we keep a global state to track the user’s progress through the application.
Constants are declared once and don’t change. In ES6, when you declare a constant once, it throws an error if there is an attempt to change it. This is like the static-tying type enforcement.
A group of series of statements strung together are called a block. A block is contained within curly brackets. { .. }
In Ruby, there are different ways to show a block. In fact, there are different types of blocks, like your general block, procs, and lambdas.
Conditions throw an error if its expression between the parentheses are not a boolean.
“Falsy” values are converted to the boolean false. “Truthy” values do the opposite. More on this in Chapter 4 of Types & Grammar
An iteration occurs each time a block is called.
Warning: For a variety of historical reasons, programming languages almost always count things in a zero-based fashion, meaning starting with 0 instead of 1. If you’re not familiar with that mode of thinking, it can be quite confusing at first. Take some time to practice counting starting with 0 to become more comfortable with it!
I rarely use do..while loops. Here’s the syntax.
do { console.log('How may I help you?'); // Help the customer numOfCustomers = numOfCustomers - 1;} while (numOfCustomer > 0);
Like C, the Javascript for loop has three clauses.
The initialization clause
The conditional clause
The update clause
Reusable pieces of code can be gathered into a function
The lexical scope, or scope, is the programming term to tell us where our variables can be accessed.
function outer() { var a = 1; function inner() { var b = 2; // we can access both `a` and `b` here console.log( a + b ); // 3 } inner(); // we can only access `a` here console.log( a ); // 1}outer();
In the example, you can’t call inner(); on the outermost scope. It can only be called within the outer function scope, as shown.
More on lexical scope in the first three chapters of Scope & Closures
Chapter 2. Into Javascript
Note: After reading through the first chapter, I realize I don’t really need to review too much. I’m going to skim this chapter and only note the things that I really think are worthwhile. Otherwise, I will keep notes on this chapter to a minimum.
No value set type is undefined.
I didn’t know null is an object type. Weird bug probably will never get fixed.
typeof null is an interesting case, because it errantly returns “object”, when you’d expect it to return “null”.
To learn: Javascript’s symbols. I’m well aware of Ruby’s implementation of symbols like :symbol_example, which are used in many different contexts like classes. Will elaborate more on this in the ES6 portion.
Arrays and functions are subtypes to objects. In my introduction to JS, I assumed “everything is an object”.
Built-In Type Methods extend the power of Javascript. These methods are like String.prototype.toUpperCase.
Coercion comes in two forms: explicit and implicit
explicit is with both types the same.
implicit is when type conversion can happen.
Coercion is not evil. There are times when you may need to convert types.
List of falsy:
"" (empty string)
0, -0, NaN
null, undefined
false
Things that can be truthy
non-empty strings
non-zero, valid numbers
true
arrays, empty or non-empty
objects, empty or non-empty
functions
== checks for value equality. Coercion allowed.
=== checks for value and type equality. Coercion not allowed. Also known as strict equality
Some simple rules for equality of when to use == or ===.
If either value (aka side) in a comparison could be the true or false value, avoid == and use ===.
If either value in a comparison could be of these specific values (0, "", or [] — empty array), avoid == and use ===.
In all other cases, you’re safe to use ==. Not only is it safe, but in many cases it simplifies your code in a way that improves readability.
I’ve played it safe with this, but I may revisit using == more often, if it doesn’t violate the rules. Important note: think critically before use.
You might think that two arrays with the same contents would be == equal, but they’re not
When comparing numbers with strings, the strings get coerced into a number. When the string contains non-number characters, it gets converted to NaN and when comparing with < or >, NaN is neither greater nor less than a value, hence returns false.
Hoisting is when a variable is moved to the top of the enclosing scope. (conceptually speaking)
Okay to use a function before it is declared as function declarations are hoisted. Generally not good with variables.
Use let for block scoped variables. For example, in an if block, you declare a variable you only want to be used within that block, use let.
function foo() { var a = 1; if (a >= 1) { let b = 2; while (b < 5) { let c = b * 2; b++; console.log( a + c ); } }}foo();// 5 7 9
Strict mode was introduced in ES5. Noted with "use strict".
Strict mode disallows implicit auto-global variable declaration from omitting the var.
I feel computer science needs to put unnecessarily long titles to items. Immediately invoked function expressions (IIFE) are involved upon declaration.
An example use case was with Highcharts and creating an options object. You can’t always assign a key with a function, so this is one way around it.
Closure is a way to “remember” and continue to access a function’s scope.
I think of this as a way to tweak functions without having to write out more functions.
This is least understood by JS developers, and I think I know why. To me, it’s a function generator, although that’s an improper term because Javascript can create a generator function, which is a totally different topic.
The most common usage of closure in Javascript is the module pattern. Modules let you define private implementation details (variables, functions) that are hidden from the outside world, as well as a public API that is accessible from the outside.
Executing the module as a function creates an instance of that module.
The this operator reference depends on how the function is called. That will determine what this is. There are four rules of how this gets set. More on this later in the this & Object Prototype book.
Prototype links allow one object to delegate properties from another object. What this means is a property prototype linked is not attached to that object but to its original object (which could in turn, just be the proto property of Object).
Do not think of applying prototypes as inheritance. It follows a pattern called “behavior delegation”, delegating one part of an object to another.
Bring the old to new with polyfiling and transpiling.
A “polyfill” is to take a definition of a newer feature and produce a piece of code equivalent to the behavior for older JS environments.
An example is lodash that has a bunch of features from ES5 and ES6 which some frameworks utilize, like forEach and map.
Careful writing your own polyfill as you should adhere closely to the specification.
Better yet, use the vetted ones.
Transpiling is great for new syntax. It is a tool that converts your code to older coding environments. You can break down the word “transpiling” into transforming + compiling.
arguments can be used functions to determine which arguments were passed in. It is not a reserved word, so you can assign it to a different value. When calling it, it outputs an array.
The book series doesn’t cover Non-Javascript, like the DOM API. But you need to be aware of it. DOM API could actually be written by the browsers in C/C++.
The document object is a “host object”, a special object that has been implemented by the browser.
Chapter 3: Into YDKJS
This chapter is a preface to the other books. I’ll skip these notes as I’ll be covering this in more detail in those posts.
I ran across the node-glob and realized I didn’t know what a glob is. I read through the node-glob documentation and found out globs are a form of pattern matching. I realized I had been using globs for a long time, like the wildcard notation, without knowing its name.
adventure time glob
Wildcards
There are generally two wildcards you can use for glob functions.
* - “any string of characters”
? - one character
There are also brackets, where the character must be one of the following, or given as a range.
[abc] - one of “a”, “b”, or “c”
[a-z] - between the range of “a” to “z”.
You can also line this up with a ”!” to mean not in the following bracket.
[!abc] - not one of “a”, “b”, or “c”
[!a-z] - not in the range of “a” to “z”
The examples above are used in UNIX-based systems. These commands are slightly different in Window’s Powershell and SQL. For more information about those systems, you can read the Wikipedia article about globs.
Node Example
var glob = require("glob");// options is optionalglob("**/*.js", options, function (er, files) { // files is an array of filenames. // If the `nonull` option is set, and nothing // was found, then files is ["**/*.js"] // er is an error object or null.});
Everybody gets critiqued. Great composers like Beethoven have been critiqued. In this review of Beethoven’s Ninth Symphony, the London Symphony picked up this quote from a Rhode Island newspaper.
The whole orchestral part of Beethoven’s Ninth Symphony I found very wearying indeed.
Several times I had great difficulty in keeping awake … .
It was a great relief when the choral part was arrived at, of which I had great expectations.
It opened with eight bars of a common-place theme, very much like Yankee Doodle … .
As for this part of the famous Symphony, I regret to say that it appeared to be made up of the strange, the ludicrous, the abrupt, the ferocious, and the screechy, with the slightest possible admixture, here and there, of an intelligible melody.
As for following the words printed in the program, it was quite out of the question, and what all the noise was about, it was hard to form any idea.
The general impression it left on me is that of a concert made up of Indian warwhoops and angry wildcats.
Some phrases pop out at me here.
great relief
made up of the strange, the ludicrous, the abrupt, the ferocious, and the screechy
it was hard to form any idea
Indian warwhoops and angry wildcats
What amazes me is easy it was for this critic to put down the famous symphony. The descriptions paint a very bleak picture of Beethoven’s 9th Symphony, painting the part the critic can recognize, the choral part, as a great relief. Yet, the adjectives used for the rest of the piece draws the critic’s point overboard.
For this critic, Beethoven’s music did not try to copy his classical contemporaries like Mozart or Haydn. Instead, Beethoven injected his character in his music, heralding the sense of individualism felt amongst the contemporary thinkers of the time. It was the time of American and French revolution. It was the time of change. It was the time of new ideas and the tearing down of the old. Part of Beethoven’s character are the strange, the ferocious and the screechy. That’s what makes a Beethoven unique. This is the critic’s failings in understanding Beethoven’s music.
Beethoven
Portrait of Ludwig Van
When I’ve listened to the 9th Symphony, I think it’s a masterpiece. Indian warwhoops and angry wildcats do not come to mind. The good news is, the critic’s words haven’t carried over to this century. Beethoven’s 9th Symphony is still played around the world today. Negative criticism for the sake of bitching and moaning from purely subjective responses rarely get carried over as time passes.
If you though Beethoven’s criticism was bad, wait to you hear what this critic says about Anton Bruckner, a Austrian composer from the 19th century. This voiced his opinion to the public, hailing Bruckner as “the greatest living musical peril, a sort of tonal Anti-Christ.” Here’s his argument.
The violent nature of the man is not written on his face—for his expression indicates at most the small soul of the every-day Kapellmeister. Yet he composes nothing but high treason, revolution, and murder. His work is absolutely devoid of art or reason. Perhaps, some day, a devil and an angel will fight for his soul. His music has the fragrance of heavenly roses, but it is poisonous with the sulphurs of hell.
Holy christ! If you give Bruckner’s Symphony No. 7 a listen, you wouldn’t think malice towards to composer who wrote this music. You’d probably shake his hand. Allowing time to pass, we see this critic for who he really is, a hater. It doesn’t matter which century you live in, these haters exist. The critic didn’t recognize the Romantic styling of that century. The sweeping melodies. The dramatic accents and motifs carried over by Beethoven. To Bruckner’s credit, he composed two more symphonies, the ninth unfinished, as well as a smaller pieces for another decade. Like Beethoven, Bruckner is still played today.
Anton Bruckner
A picture of Anton Bruckner
As a side note, you may have already realized it. These two pieces were admired by Hitler. This was not intentional, and I would have missed this reference if it was not for Wikipedia. So, to leave this on a high note, Wikipedia says the adagio from Bruckner’s Symphony No. 7 was played on the official radio announcement of the German defeat at Stalingrad on the 31st of January, 1943. Karma, I guess.