An open office

How to work in an open office

I’ve spent the past 16 months in an open office environment, which has been both a positive and negative experience. I gathered these thoughts on how to make the experience better.

Be quiet, clean, and odorless

Stimuli that you are not in control of can be a major stressor. Stressors, of course, reduce happiness and productivity. Do not be a happiness and productivity killer! If you annoy your coworkers, they may start to dislike or resent you, which will not be good for your career or job satisfaction.

Bottom line is, be aware that every action you take may emit stimuli that affect your coworkers.

  • Do not eat at your desk. No matter how hard you try, someone will dislike the smells and sounds of you eating.
  • When you use headphones, leave them off at first to make sure the sound isn’t audible.
  • If you must tap your foot, either (a) bounce your  heel up and down without the heel ever touching the floor or (b) bring in something soft to put under your foot to eliminate the noise.
  • Take all phone calls away from your desk. Every time. Even if it is five seconds.

Relevant study on occupational noise here and a Harvard Business Review article on the subject here

Be pleasant

Stress, anger, and pessimism are contagious. But so is positivity! Dealing with stress and emotion in a healthy manner is important for your own sake. But the stakes are higher when you can ruin someone else’s day. If you feel yourself losing it, get up and take a walk.

Train your coworkers on interruptions

When people interrupt you, first, remember to be pleasant. Second, triage the interruption.

If it is….

  • … social and welcome -> leave the coworking space to a social space and have a chat
  • … social and unwelcome -> politely ask to talk after work
  • urgent -> find a private room and discuss the details of the urgent task
  • … important -> ask them to send you an email or message and tell them you will respond within 30 minutes (or sooner or later depending on the importance)
  • … normal -> ask them to send you an email and tell them you will respond within 24 hours

If you follow this formula consistently, eventually your coworkers will learn how to communicate with you effectively.

Do not come to work sick

If you are well enough, ask to work from home. When you come back to work, do not touch other people’s stuff, wash your hands often, and disinfect your work station a couple times a day.

 

 

Why I don’t need jQuery anymore

Internet users and developers have a lot to thank jQuery for. However, given my primary use cases for jQuery, it is 80+ kB of JavaScript that I no longer need to send to my clients.

Selection

When I first started programming for the browser, I had no idea how to select DOM elements without jQuery. Even after I learned, I still found $('#id') and $('.class') to be convenient and aesthetic. I now realize however, that a little convenience and sugar does not justify a relatively large dependency.

Plus, the vanilla way of doing this really isn’t bad!

document.getElementById('id');
document.getElementsByClass('class');

AJAX requests

I actually knew how to do this one without jQuery first, but it’s not pleasant.

xhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    document.getElementById("demo").innerHTML = this.responseText;
  }
};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();

Here $.get() and the other AJAX features of jQuery are giving us more than convenience. They give us readability and good code organization, especially with the relatively recent addition of promises to the jQuery API.

But wait! Do we need an 80 kB library for making AJAX requests? There are alternatives, like request.js (17 kB), that do just HTTP requests, and they do it well.

Note: If you are not already, using a bundling tool like Browserify will grant you independence from jQuery. Your front-end code can depend on any npm package. Browserify will bundle all the required modules into your code that gets shipped to the browser. This will give you more tools to reach for than can be conveniently included by linking to a CDN in a script tag.

DOM manipulation

I have written a lot of naive code where I use jQuery to update DOM elements with data returned by an AJAX call (also made with jQuery). I do not do that anymore, now that I use React.js. React takes DOM manipulation out of the picture. You simply define what components look like, and how they respond to state changes. React will do all the manipulations for you!

Bootstrap

It seems to be widely accepted that you should not ship a Bootstrap site into production. However, Bootstrap is still great for prototyping and personal projects. Plus, there are many projects where your end users will be more than pleased with a Bootstrap site. For instance, if I was asked to create a small tool for our sales team, I would likely reach for Bootstrap to get mobile responsiveness and a modern look with little effort.

Okay, justification over.

First of all, if you are just using Bootstrap for its CSS, you’re good! You are already not depending on jQuery.

However, if you are using Bootstrap plugins, then you are depending on jQuery plugins under the hood. Apparently, other people also felt this was a problem. Projects like Bootstrap Native provide all the functionality needed by Bootstrap in vanilla JavaScript.

Resources for getting started with React.js

I’m starting to dig into React.js, the front end framework from Facebook. Here’s the three most helpful resources I’ve found so far. After these, you should be ready to get your hands dirty with a prototype and really understand what you’re doing.

React.js logo

You Don’t Know JS by Kyle Simpson

This book series is a great resource for competent developers who are new to JavaScript. It may be a little steep and fast-paced for someone with no programming experience.

I spent the past year working primarily on server-side Java. This book is helping me to write idiomatic JavaScript, instead of carrying over Java habits and patterns. Kyle dives into some of the trickier aspects of JavaScript, and how to correctly leverage the language features that many consider flaws, like dynamic types and loose equality. The series is freely available to read online!

JavaScript Jabber episode 73: React with Pete Hunt and Jordan Walke

JavaScript Jabber is the most popular JavaScript-specific programming podcast I was able to find, and I was pleased to see they had an episode on React. They talk with Facebook / Instagram employees who use and contribute to React.js. Pete and  Jordan explained the philosophy behind React, how to think about React apps, and the internals that make React work.

The React docs

Some docs are written more as reference guides to keep handy. The React docs do serve this purpose, but they are also really consumable as a standalone piece prior to building an app. The docs provide approachable explanations of React philosophy accompanied by digestible examples. Tinker with the examples as you work through the docs in a React JSFiddle.

A biophilic office

Add nature to your workspace if you can

As a psychology student in undergrad, I was interested in studying how to persuade people to take action on climate change. I thought I hit a treasure trove when I discovered the body of literature on environmental psychologyAfter reading hundreds of abstracts from The Journal of Environmental Psychology for a meta-analysis, I discovered I was wrong. Environmental psychologists are interested in how the environment around humans affects behavior.

Something I discovered in all my reading was the nearby nature effect. Being exposed to nature, or images and sounds of nature, can boost mood and happiness as well as increase job satisfaction and productivity. Just adding potted plants to a workspace can make a measurable difference.

It seems the trend for offices, especially at tech companies, is increasingly sleek but sterile environments. Biophilic architecture may be a better route to to foster engaged, happy, and productive employees.

If nothing else, you can at least change your desktop background.

Unit testing as a learning tool

If you are already familiar with a programming language and you want to learn another, your first stop should be learnxinyminutes. You  can quickly read through examples of all the basics to get a sense of the syntax, and use it as a quick reference while coding.

Your second step should be writing a unit test. 

  1. Figure out what the dominant unit testing framework(s) are. You will learn a lot about the community around your new language from the twenty minutes you invest researching.
  2. Set up your environment for a test. Follow the instructions you found in step 1. You’ll probably learn about package management and other features of the language your are using!
  3. Write a trivial test and run it. It runs! Wow!

Now, when you go to implement your first small project using the language, you will get so much more out of it. You won’t have to re-boot a web app to test code changes. You won’t dirty up your main.

For your first project in the new language, I recommend implementing a math-oriented command-line project to familiarize yourself with the language itself, before you dive into a web framework or something like that. For instance, a program that lists all primes under a given number. It’s easy to write tests for these kinds of projects and you get some quick wins. Then play with whatever framework your heart desires – you’re ready for it!

How to register to vote in Indiana

If you will be 18 by November 8, 2016 you can vote in the Indiana primaries. It’s super easy. Seriously, you can do it on your phone right now.

Not sure if you’re registered? You can check Check if you’re registered to vote.

Required materials

  • valid Indiana driver’s license
  • Internet access
  • 3 minutes

Steps

  1. Browse to Indiana’s online voter registration
  2. Answer the questions

That’s it!

What next?

You’ll get your voter registration card in the mail. You’ll take this with you when you vote.

You can find out where you can vote here. Put in your info and then check out the Polling Place tab.

The primaries for the 2016 presidential race will be on May 3rd. Go to your polling place on May 3 to vote. Democracy!

Figure out who to vote for. I Side With put together a really nice quiz to figure out what candidates agree with you on various issues. You can skip any questions you’re unsure about. The results are really accessible, but rich with detail if you want to drill down into it.

 

 

 

ApexSQL has all the features I want they just don’t work like I want them to

I want SQL Server Management Studio to work more like an IDE. So I was pleasantly surprised that ApexSQL offers database object searching and SQL code formatting SSMS plugins for free. Unfortunately, these two features work in ways that render them basically unusable to me. I am not one to complain about something that someone else made and gave me for free. But perhaps this criticism will result in updates, or someone else making plugins for SSMS, or even future iterations of SSMS shipping with these features standard.

 

Installation

Just head over to the ApexSQL download page. You have to provide a name and email, which is kind of poop, but I was checking it out for work so I just used my work credentials. ApexSQL has a ton of products. I just downloaded the installer. Once that was up and running, I just selected the 3 free products: Complete, Refactor, and Search. The installer will detect that you have SSMS installed. After installation, you will notice a new toolbar at the top of SSMS.

 

Code formatting

There are a 145 options you can configure for code formatting. They cover a lot, and just being able to automatically switch case and add semi-colons is huge. My suggestion here is to allow use of configuration files, rather than having to set everything in the UI. If the formatter configuration does not live in source control, then it cannot be used by most teams.

Object searching

It was about to be awesome. Press a hotkey combination and up pops a search box. Just like type searching in eclipse (ALT+SHIFT+T). But the search algorithm isn’t great and you cannot filter by object type. If you search for TableName, you will probably encounter the first TableNameKey column in a different table. AND the search does not filter out non-matches. It just takes you to the first hit, inside of a giant list of all database objects. For me, this renders the feature useless.

Execute and rollback

One feature I was not expecting is an execute and rollback button in the ApexSQL toolbar. You can run a script to see if it works. The results are automatically rolled back. For this feature, I’m keeping ApexSQL plugins installed. It should really increase productivity to not have to manually rollback changes every time I try out a script I’m writing.

Coding the Butler Way

At an awards day for college of liberal arts students at Butler, our student speaker Elizabeth Davis related her internship doing pediatric cancer research to the five principles of Butler athletics and challenged us to live out the Butler Way in our own pursuits. The Butler Way received national attention (e.g., Washington Post, Forbes) due to the success of Butler Men’s basketball. I’m proud to attend a university that is famous for its values.

Five principles summarize the Butler Way: humility, passion, unity, servanthood, and thankfulness. These principles are not just for athletics. They are great principles to live by, and – I argue – to code by.

Humility

Jeff Atwood blogged about the importance of humility and about assuming issues are your own fault. I don’t mean to repeat his work here.

However, I will say this. Humility is a beautiful posture. Humility is the posture of learning and of delighting in the success of colleagues. Humility is the posture of craftsmanship, of transcending the self to become fully invested in the product of your labors.

Passion

The passionate programmer strives for more elegant solutions, for cleaner code, and for more beautiful designs. Learning new technologies and design patterns and keeping up with industry should be fun, not tedious. Programmers who love the craft of software development will always outperform others, because building better software is its own reward for the passionate.

I am not measuring passion in hours. There are more important things in life than coding. Enjoy those things. But code with passion.

Unity

Unity is shared commitment. Refraining from dissent and criticism is dangerous. In my opinion, conformity is a sign of disunity. A group that values harmony has too many private interests, whether it be pleasing authority, avoiding conflict, or just getting through the day. There is an important unity in disagreement. A group that encourages dissent displays an unshakable, shared commitment to building quality software. 

Servanthood

Your legacy is more than your code. Try to find ways you can improve your organization and your community. Engage and serve.

Thankfulness

There is no benefit to spending the day frustrated with colleagues, upset about decisions, and angry at code that keeps breaking. You can miss a lot when you are focused on these things. We are fortunate to be in a field where it is relatively easy to get a job. We are fortunate to be in the top one percent of income. We are fortunate to work with our minds and solve problems every day.

Cultivating gratitude makes you happier and healthier. And there is so much to be thankful for.

The 3 F’s of Abandoning Ship (and Getting on a Better One)

The three F’s are not a handy acronym. They’re a limit to the number of times I will curse before I try a new approach to solving a problem.

It’s not good to code angry. It’s not good to live angry, for that matter. Frustrated developers are unproductive developers. Monitor your frustration, and know when it is time to change you’re approach. 

Solving problems is what software development is all about. It’s not these problems that elicit vulgarities. It’s the little things that get in the way of the main problem. Configuration issues. Tooling issues. Not-understanding-an-API issues.

The 3 F’s also let me know when I need to take the time to do something the right way. In exploratory and prototyping stages, it may be appropriate to do something quick and dirty. Like writing the same line of code twice instead of abstracting. Like executing some SQL manually instead of scripting it.

But when that third F-bomb drops, I know it’s time to stand up, close my eyes, take a deep breath, and start fresh. I know that I’m probably doing something unintelligent, and I need to revisit some basics or find a new approach to solving the mini-hindrance to get back to the main problem.

Featured image uploaded by user kuba to openclipart.org. Image retrieved from openclipart.org/detail/191792/william-morris-letter-f.   

I’m in love with Python and I don’t care who knows it

Okay, maybe I’m not in love. But it’s more than infatuation if it lasts longer than a year, doesn’t it?

I treat languages as tools. The right tool depends on the job and the people working on it. So I am by no means dogmatically pro Python. It has a lot of serious problems. The Global Interpreter Lock makes it inappropriate for multi-threaded, CPU intensive applications where speed is crucial.

To me, the beauty of python lies in its readability, REPL, and community. All of these factors make it super easy to quickly create working software. I can quickly implement concepts, architectures, and algorithms in Python, and  stay focused on the ideas (rather than syntax, memory, and other nastiness). It’s been freeing. I have pushed up a lot more to GitHub, because Python has made it so easy (and fun) to try out ideas.

It reads like English

Because of the reliance on white space and natural-sounding keywords, Python reads like English. Execute doSomething() only if uri_string is not in a list of permitted URIs?

if uri_string not in uri_list:
  doSomething()

The intention of the code is immediately clear.

God bless the REPL

Not unique to Python, but working in a read-eval-print loop loop is a joy. It significantly cuts back on debug time. In compiled languages, my workflow is write, compile, run, examine stack trace, repeat (WCREL?). With Python, I normally play in the REPL and make sure that my code is going to work the way I think it will before I actually modify my code.

The Pythonic way of doing things

It’s not a good enough reason to things just because other people are. But it is a good reason, and probably the deciding factor all else being equal.

We code in community. The Python community has conventions (and sometimes some strong opinions). These conventions, once known and understood, make reading other peoples code even easier, and elucidate programmer intentions.

It’s easy to find good discussions among Python programmers. I dug around trying to figure out if there was a compelling reason to use list comprehensions over anonymous functions to manipulate a subset of elements of a list. I found a lot of information, including references that list comprehensions are more Pythonic, because they are more readable.