Sunday, July 13, 2014

Creating External Hooks In AngularJS Directives

I ran into an interesting problem a few weeks ago at work. I was working on a stand-alone widget/directive that had the following requirements:

  • Create a widget that shows the amount of comments for a given resource.
  • Pull the count from a site commenting service.
  • Move focus to another widget (most likely a related commenting widget) when this widget is clicked.
    • The other widget may or may not be an Angular widget.
  • Allow external widgets/things tell the directive to update its comment count from the service.
    • The external "thing" may or may not be an "Angular thing".

Since the widget would usually be in an Angular app, making an Angular directive seemed like the thing to do. The directive would also be offered as a self-bootstrapping chunk of javascript for pages that weren't using Angular but that's beyond the scope of this post.

Making the widget itself wasn't too bad but making those external hooks was a bear (for me anyway). The code is a little stripped down for public consumption but here's basically what I started with:


Move Focus To Another Widget


First up was moving focus to another widget. This actually wasn't too bad but my first attempt was pretty terrible (it involved some external javascript object that was difficult to use). Thanks to some tips from a coworker, it was decided to use a bit of the jqLite included to trigger a jQuery event on button click.


And then the accompanying html:


There are a few things that may seem odd here but they are super important to remember:

  • Because jqLite is being utilizing here and this seemed like a "view-like" interaction, nothing is going down to the controller.
  • The triggerHandler method is being used rather than trigger because jqLite doesn't offer trigger.
  • Rather than using the jQuery event construction shorthand, it's important to pass in an Event object. I'm uncertain to why, but it's the only way it would work.

Update Widget From External Source


Like the previous requirement, my first attempt was pretty terrible until I brought jQuery events into the mix.



I love the simplicity of the solution here. Through jQuery the external script sends an event and it's picked right up by the directive. Very, very slick.

What I learned through all of this was while I was beating my head against my keyboard trying to figure out how to come up with a solution that was "The Angular Way", I forgot that at the end of the day, it's just javascript. And because it's just javascript, you can usually pull in whatever library to help you accomplish your goals or even just do something in vanilla.js if it comes down to it.

If you're interested in the end result, head over to this gist here. Getting that directive under test was half the battle as well so all of the tests are included. Please leave a comment if you have a question or if something is missing.

Tuesday, May 20, 2014

Yes, You Belong Here - Helping Others With Impostor Syndrome

This is part three of the series on my talk about impostor syndrome. You can read the first two parts here and here.

In part two I discussed things that you can do to overcome and manage impostor syndrome. I'm going to wrap things up by discussing things you can do to help others affected by impostor syndrome. Whether you aren't affected by impostor syndrome or have a good handle on it, there are always things you can do to help.

Improving Your Impostor Radar


Before you can help anyone with impostor syndrome, you need to know how to recognize people affected by it. This can be tricky because remember, they already feel like an impostor and will most likely be trying their best to hide signs that they're feeling this way.

Someone with impostor syndrome may regularly disclaim or understate their experiences or skills. You can see this in their speaking or writing when you encounter phrases such as "sorry if this isn't very good but..." or "yeah, I didn't work on it very hard so sorry about the quality".

Another sign may be not willing to take credit for their role in projects. You may even need to nudge it out of them. Their work may actually be good but they don't want attention called to it in case it doesn't measure up to others that they feel did most of the real work.

Self-deprecating humor isn't always a sign of impostor syndrome as some people just enjoy getting a laugh at all costs but it's something to be aware of. Look for the more cutting humor that can be painful or uncomfortable to hear.

Now What Do I Do?


Have an idea of how to spot those with impostor syndrome? Here's what you can do to help.

The Hacker School has a few guidelines that are not only aimed at helping combat impostor syndrome but they're good to follow in general to be a good human being:

  • No feigning surprise
    • e.g "Really? how do you NOT know what a lambda expression is?"
  • No well actually's
    • Well actually...
  • No back-seat driving
    • Fully engage or not, don't just butt in sporadically.
  • No subtle sexism
    • Or any other isms. This has no place in the workplace either. Just don't.

This may seem like common sense but something that's helpful is to simply recognize and call out successes. If you see someone doing awesome stuff, say something! Even if they don't have impostor syndrome, they'll be happy you did. I've never heard of anyone regret uplifting someone else.

Another thing that has been helpful to me in the past is "give people permission to start". What that means is some people may want to put themselves out there but are reluctant to do so because they're feeling a bit of impostor syndrome. All they may need is for someone to believe in them and let them know that they'll do fine.

Remember in the last post I talked about how people with impostor syndrome need to avoid negative people? Don't be a person that they need to avoid.

Be proactive when offering help. Remember that people with impostor syndrome want to avoid situations where they may be revealed to be an impostor so asking for help may be difficult for them. "Let me know if you need help" is usually not enough. A better approach is to ask directly if they need help so that there's one less barrier to getting help on a project or problem.

Finally, if you happen to be some sort of geek celebrity, remember that with great power comes great responsibility. Find ways to help those with impostor syndrome if only just making people aware of the problem and how to deal with it.

The (Not So) Surprising Truth In All Of This


Here's the most important thing that I've learned through studying impostor syndrome:

We all experience some degree of impostor syndrome.

It's actually normal and healthy to feel this way. As you learn how to manage and avoid the negative effects of impostor syndrome, you can use it to move yourself forward. You may not be 100% successful at first but as your grow in your career it will become easier to manage.

I hope reading these posts have been useful and have given you some incentive to learn more about impostor syndrome. Help others be aware of it by sharing your own experiences in a blog post or talking about it.

If you're currently suffering from impostor syndrome, I hope I have given you enough resources to get started on managing it. There are more below as well.

If you know someone that is suffering from impostor syndrome, see if you can help them. Simply learning what it is called is tremendously helpful.

If you find yourself asking yourself, "do I belong here?" remember that the answer is "yes you do".

Thanks again for reading. Please comment below if you have any questions or comments or hit me up on Twitter and Google+.

Resources




Photo Credit, David Niblack, Imagebase.net

Sunday, May 11, 2014

Yes, You Belong Here - Overcoming Impostor Syndrome

This is part two of the series on my talk about impostor syndrome. You can read the first part here.

Overcome yourself
In part one, I discussed what impostor syndrome was and the effects of it. Hopefully you don't feel limited by the effects of impostor syndrome but if you do, I hope this post can start you on a path that leads you to managing it so that you can succeed.

First Step, Education


The first step in dealing with anything really is to educate yourself about it. You're here reading this post so you're already taking steps to educate yourself, good job. Some resources that really helped me recognize and learn how to deal with impostor syndrome include:


There's also another impostor syndrome talk by Nickolas Means that was at this year's rails conf that's supposedly very good but I haven't been able to find a video of it yet so keep an eye out for it.

As you educate yourself about impostor syndrome, here are some things I've found to be true and to keep in mind:

You suck at evaluating yourself


We are our worst critics. This isn't just for people affected by impostor syndrome, most people are terrible at evaluating themselves. It's good to self-reflect but take your self-criticisms with a grain of salt.

Impostor syndrome will probably never fully go away


This sounds worse that it sounds. Impostor syndrome syndrome can be managed. In fact, if you manage it well, it can actually slingshot you into greatness.

Procrastination != bad technical skill


What do I mean by this? There are people in this world who are just awesome at managing their time and getting stuff done. Does this mean they're smarter or more intelligent than you? No, this just means they're good at managing their time. This distinction is important as procrastination is something that can often lead you to feeling like an impostor.

Don't get me wrong, procrastination is still a problem, but separating your intellect from time management skills can help you manage impostor syndrome. If you have a problem with procrastination (like yours truly) I highly recommend this series of posts at waitbutwhy.com, here and here.

Armed With Knowledge, Time For Action


With these things in mind, there are many things you can do to help manage impostor syndrome.

An important (and maybe most difficult) step is to get help from others. Because you're terrible at evaluating yourself, find people you trust to give you a realistic view of how you're really doing. This also gives people who want to see you succeed a chance to help you out when they may otherwise have no idea of what you're going through.

Avoid negative people and situations if possible. Negative people can drain your emotional energy; energy that you may not have to spare. They don't owe you anything and neither do you. This can also include social media. Unfollowing is easy and it only hurts for a second ;-).

Find a system or belief that gives unconditional love and acceptance to get hidden strength from. Find worth outside of your intellectual pursuits. Putting too much emphasis on intellect can be a source of imbalance in life. I've found that if I've been neglecting my religious studies or exercise, I get overwhelmed easily.

We get so involved with the present that we don't take a moment to see where we've been. Play the long game and don't worry about the day to day so much. Even if you're not improving as fast as you'd like, as long as you're constantly improving you're winning.

If you experience a success, celebrate! Tweet about it, write a blog post about it, just do something that will remind you that you have successes. At the same time, if you fail, learn from it and then move on. Remember that everyone fails and every failure is a learning opportunity.

If you find yourself hesitating from trying out something with a chance of failure, think of it as a big experiment. Then think, "what's the worst that can happen... really". People bounce back from pretty bad failures, oftentimes stronger for it. And then think, "what's the best that can happen?".

If you have intellectual heroes or have some favorite geek celebrities, remember that they are human too. They had to work hard to get where they are and their circumstances are simply not the same as yours. Everyone has strengths as so do you. Measure yourself against yourself and use your unique strengths to be awesome.

Help others. It's scary, you might fail, and yes, you will feel like an impostor at first but after doing it for a while, people will start coming to you for help. Let me tell you, having people come to you for help flies in the face of impostor syndrome!

Finally, some simple advice that my mother always gave me was totally cliche but is true in many respects:
Fake it 'til you make it
This is weird advice because I'm basically telling you to be an impostor. If you already feel like one, why not own it? There are a lot of smart people out there but you'd be surprised to find that they're all faking as well. The only difference is they're not letting it hold themselves back so why should you?

Thanks, But I'm Pretty Sure I Don't Have Impostor Syndrome


That's great! That means the next post is for you. Next time I'll wrap things up by talking about what you can do to help others with impostor syndrome. Once again, feel free to comment below or hit me up on Twitter or Google+.


Photo Credit, Tim Alosi, Flickr.com

Friday, April 25, 2014

Yes, You Belong Here - What is Impostor Syndrome?

This is part one of the series on my talk about impostor syndrome. You can read the second part here.

This past month I spoke at the 2014 Spring Utah Code Camp. I don't speak at conferences generally (2nd time speaking at a conference) but was convinced by some friends that I should speak about something. I only like to speak about subjects that I know quite a bit about and since I've been fighting a mild case of impostor syndrome on and off for the past year or so, it felt like a good fit.

My slide deck is fairly minimal and the talk wasn't filmed so this is part of a series of posts that go with the talk for those that are interested.

Do You Feel Like An Impostor?


Looking up impostor syndrome in Wikipedia:

[it's] a psychological phenomenon in which people are unable to internalize their accomplishments […] those with the syndrome remain convinced that they are frauds and do not deserve the success they have achieved

It's not a pleasant way to live. You feel like everyone in your field is smarter than you and somehow you haven't been found out yet. You live in fear that some day, someone is going to call you out on how much you suck and then you will be cast out, never to work in the field that you enjoy again.

The real tragedy is you may actually be quite good in your field and have been recognized for it but you get so fixated on some failure you've had or on some skill-set that you're missing that you have a hard time seeing how good you may actually be. This tends to lead to destructive internal thoughts such as:

  • "I got lucky"
  • "I'm not smart"
  • "I'm not a good developer"
  • "I'm a phony"
  • "I don't belong here"

At best, this kind of talk just makes you sad for a few days and then you move on but at worst it can lead to depression and possibly leaving the field because you feel that you'll never measure up.

More Invasive Than You'd Think


Why should developers learn about impostor syndrome? Unless you're making some really small-scale programs or mobile apps, chances are you're working on a team. Because of this, I would argue that at least 50% of your time working is spent interacting with other people through code reviews, pairing, meetings and general socialization. Because so much of our time is spent interacting with people, we can increase team productivity as well as help each other by being aware that such problems exist.

The thing is, us developers are so susceptible to impostor syndrome. In fact, any intellectual profession is very susceptible to impostor syndrome. I can't speak to how severe it is in other professions but we bring it down pretty hard on ourselves. Just look at our job postings, I pulled these from actual postings:

  • "...looking for a JavaScript and jQuery guru..."
  • "Come work with a team of AlphaGeeks, Git Ninjas, and Linux Jedis!"
  • "Startup Superhero/Ninja Internship"
  • "We are looking for a rockstar front-end developer to join our team."

Not all postings look like that but we sometimes have a hard time passing up the chance to be called a guru or ninja at work (hell, I want to be a superhero; Sr. Software Engineer just doesn't have the same ring to it).

Because we work in an intellectual profession, we surround ourselves with smart people. This is good because we want to learn from smart people but we can sometimes develop impostor syndrome by imagining that we'll never measure up to our colleagues.

We see other developers in social media and open source and praise how intelligent they are. We have our own little set of celebrities that we follow (you can see mine here). Someone with impostor syndrome may get discouraged comparing themselves against these geek celebrities.

A lot of developers may have been told that they're just naturally smart by parents or teachers when growing up. While good-intentioned, this can give someone a fixed mindset that they are "a smart person" and situations that may prove otherwise can contribute to impostor syndrome.

Side Effects May Include...


Impostor syndrome can be the cause of some unfortunate behaviors that only further entrench someone with impostor syndrome.

They may be afraid to contribute to discussions in fear that they may reveal their ignorance and be found out as an impostor. They may have no desire to contribute to things such as open source, write on blogs or contribute to online discussions.

There was a story last year about someone that pushed some code out on Github only to have it openly mocked on Twitter. This is the worst nightmare of someone that has impostor syndrome. Remember, they already feel like an impostor and this is like shining a spotlight on their perceived inadequacy.

In some cases, someone with impostor syndrome may put up with a job they might not like because they're afraid to interview. They may feel that they're not good enough to get a job somewhere else and that they're lucky to have the one they have.

Impostor syndrome can push people to level up in their skills but if they have a distorted view of what "normal" is in your field, they may keep trying harder and harder only to burn themselves out chasing this unattainable view of "normal". This is the kind of thinking that leads people to depression and giving up on programming.

Thanks Bressain, Now I'm Sad


Sorry about that, there really is a silver lining to all this though! I don't want to try to fit everything into one post (already at tl;dr length IMO) so next post will be about what you can do about impostor syndrome. Feel free to comment below or hit me up on Twitter and Google+.

Sunday, February 2, 2014

Adventures In Losing Weight

Adventure
I know a lot of developers that struggle with obesity and the problems that go with it (I even have a mild case of peripheral neuropathy to show for mine). Between sitting at a desk all day at work (sometimes at night as well) and living an American lifestyle, it's easy to gain weight. Losing weight (or at least talking about it) is a time-honored tradition in my family (blame my mother's side) so it makes sense that I make at least one post about it.

In my annual physical about 3 years ago (they're free for any insurance, you should go), I noticed that the scales had me at 330 lbs. I couldn't believe that I had gotten that big. I have always been big but this was just nuts. I would get winded playing with my kids or going up several stairs and it bothered me. I don't need to be super fit but I need to be able to function in life at a level I feel is normal.

After educating myself a bit and finding diets that work for me, I've managed to get down to about 265 and have kept it there for over a year. I'm eating mostly normal now and plan on losing more once summer rolls around (something about winter just kills my motivation).

A disclaimer before I get into what I did:
  • I'm a software developer, not a dietitian. This is just advice from some guy.
  • This is what worked for me. Everyone is different when it comes to diets.
  • Talk to a doctor to before you start any diets or extreme exercise routines.

The best diet is the one you can stay on. There are however, some constants out there that you can't ignore and are important to understand.

Educate Yourself


There are a lot of websites and books to read about weight loss but the one that spoke to me the most was the Hacker's Diet. Click that link. The book is free and it's written by and for engineers trying to lose weight. It explains how there really aren't any shortcuts to losing weight but on the other hand, it really comes down to the first pro-tip in dieting:
Pro-tip #1: Eat less calories than you burn.
The other big thing I got out of this book that it seems a lot of people don't understand:
Pro-tip #2: Losing weight is 80% diet, 20% exercise.
Exercising is good. You will live longer by exercising but what's easier, running a mile or skipping on a cookie? I love cookies as much as the next guy but I hate running more. You choose.

Dieting


So now that we know we need to cut down on what we eat, how do we do that? There are many diets out there but once again, the best diet is the one you can stick to. I have tried a few diets and have learned something from every one. Here are the ones I have tried:

Weight Watchers - I think Weight Watchers is the most like eating normal than any other diet. They favor healthy foods over sweets and their point system is easier to do than just straight up calories. But if you don't have the money for it, you may want to look elsewhere. I think I lost about 15 or so pounds on this.
Pro-tip #3: Tracking what you eat is a powerful tool.
Ideal Protein - Wow, you thought Weight Watchers was expensive? If you can find someone to give you special prices on the food, the pricing isn't that bad. There are even forums out there that can help you put the diet together for very little money. This is a very, very effective and fast acting diet but it's too restrictive to live on. If you plan on doing this, make sure you have something planned for when you go off of it. I think I lost about 30 pounds on this.
Pro-tip #4: Only eating what you plan to eat guarantees results.
Paleo - I'm not sure who started this but the best resource I've found for explaining it is at Nerd Fitness. I have never fully bought into doing 100% strict Paleo but I have found it to be the easiest diet to live on if you're willing to plan your meals and give up on some comfort foods you may be used to. I think I lost about 10 pounds on this.
Pro-tip #5: Protein keeps you full much longer than carbohydrates.
I'm currently doing a modified Paleo diet of sorts. I'm losing as fast as I was on Ideal Protein but I don't gain while following it. Some other tips that I found for all diets include:
Pro-tip #6: You're not hungry, you're thirsty. Drink lots of fluids so that you know for sure.
Pro-tip #7: Don't stay up late so you don't feel the need for that "4th meal".
Pro-tip #8: Never drink your calories. Water is best but diet soda still has zero calories. 

Tools & Gadgets


To help with dieting, I've found some tools to be very useful which brings me to another pro-tip:
Pro-tip #9: Measure all the things!
If you don't measure it, you can't know if you're improving. Here are some things that have helped me:

  • Scales - Doesn't matter which kind you buy, weigh yourself at least once a week. I weight myself daily which can be depressing if you don't have something like...
  • Libra Weight Manager - I know there are similar apps on the Apple app store, just search for Hacker Diet. This gives you trending lines so that even when your weight fluctuates, it gives you a good idea of if you're losing or gaining.
  • MyFitnessPal - Good website, good apps, good integration with other tools and social integration. Use this if you want to track what you're eating, exercise or weight loss goals.
  • Fitbit - Gamify getting off your ass! This helps encourage me to go to the further bathroom at work or to park further away just so I can get that extra few steps. I rarely come close to the recommended 10k steps a day but it still helps give you visibility to what you're doing in a given day. I love the social element too so if you have one, add me as a friend!
  • Get Up And Code - Not so much a tool but a great (free) resource for getting fit in the context of being a programmer. I've learned a few things (and have had a few beliefs challenged) listening to this podcast.

Still Adventuring


I feel so much better than when I was pushing 330 lbs but I'm not done yet. I would like to get my waistline much smaller and I would like to be stronger as well. I feel pretty confident that I know what I need to know to lose weight but I'm still learning how to effectively exercise. Maybe once I have a better grasp on that I'll write another post.
Pro-tip #10: Don't diet alone.
I couldn't have gotten this far without the help from my wife and some friends like @codeforth. I've also gotten some great support and advice from the guys on the Be Healthy Yammer group (ask for an invite if you're interested).

I'm always up for a conversation about weight loss so feel free to comment on the post, send me a tweet or email if you have any questions. Good luck on your own adventure!

Photo Credit, David Niblack, Imagebase.net

Monday, December 2, 2013

Thoughts On SCNA 2013

I had the opportunity to go to SCNA this year. It was a lot of fun and represented a lot of firsts for me:

  • First time going to SCNA.
  • First time going to Chicago (and trying the pizza there).
  • First time going to a conference outside of Utah.
  • First time being in a skyscraper over 20 floors (the event was on the 80th floor!).

I tend to lean towards introversion so conferences can be a bit draining for me but I'm glad I went. I was pulled completely out of my comfort zone which forces me to grow which is one tenant of software craftsmanship that I like.

I thought it would be interesting to put down my thoughts on my experience for anyone interested or at least so that I can reflect on them later.

Overall Themes



TDD


Within the software craftsmanship community, test-driven development is one of those things that's just expected. It's no longer new, hip or edgy, it's just what you do when you develop. You don't want to hit people over the head with it but it should be something that you are actively trying to improve on.

Naming


Naming is one of the hardest things in software development. If you've ever tried to work on code where a method name says one thing but the code ends up doing way more than was advertised, you know how important naming really is. My favorite thought was from Sarah Gray: "naming is an extension of thinking".

Dreyfus Model of Skill Acquisition (link)


The Dreyfus model of skill acquisition (or skill expertise) came up many times during the conference. You can follow the header link for more information but the major themes were to not get yourself stuck in the advanced beginner stage and also to strive for mastery to be able to rely more on intuition rather than active thinking.

I found these topics to be very interesting as I feel that I got stuck in the advanced beginner stage a lot in the past. Oh, I still get there occasionally but being aware of it helps me get unstuck before it becomes too much of a problem. The book I'm currently reading talks a lot about this and is worth reading if you want more information.

Striving for mastery is ultimately what software craftsmanship is about and it was nice to see people talk about why. Why do we strive for mastery? Is it so we can say we're better than others?

We tend to have a finite amount of deliberate thinking cycles which limit how many tasks we can juggle in our heads at any time. When we first learned to drive, we probably couldn't even listen to the radio because all of our concentration was on driving. With years of practice, we can even kind of zone out on a commute and wonder how we got home.

With enough practice, we can move deliberate, effortful tasks to the intuitive, automatic parts of our brain. This frees up deliberate cycles to work on more important tasks that require our attention. The important thing here is practice.

Favorite Talks


I enjoyed pretty much every session at SCNA. Some were nice because they reinforced what I already knew while others were simply entertaining. There were a few that stood out and made me think.

Ken Auer - Craftsmen Cannot Live on Stack Overflow and Github Alone


Software teams will usually have or work with a "subject matter expert". This person is usually very familiar with the business problem that the software is trying to solve. They may not know the technical details on how to solve the problem but they know if the problem has been solved or not. Ken pointed out that as software developers (or craftsmen), we should be subject matter experts as well; not of the business but of quality code. After all, who else will point out when code has become too smelly or will become a maintenance nightmare?

One harsh reality of software development (and Uncle Bob pointed this out recently) is a development team is limited by the expertise of the most skilled member. This is something I've always felt strongly about as while I don't mind helping less skilled developers improve, unless there's someone more skilled than I am on the team, I know I'm going to stagnate or worse, get stuck in the advanced beginner stage. This also got me thinking about pairing and how it can expedite the process of getting everyone on a team on the same expertise level.

Dave Thomas - Unknown Knowns


This session kind of broke my brain and I still don't fully understand what was being taught. What I did get out of the session was experts have tacit knowledge that is difficult to pass on to other people.

Tacit knowledge is knowledge that you can't necessarily write down for people to reference later. Because of that, it's important to teach what you have learned, rather than what you have been taught. For example, we teach unit testing but the reasons why we test are more interesting since there may be a better way to solve the problem testing solves, we just haven't found it yet. If we teach with passion, we can infuse some of that tacit knowledge into others.

Ron Jeffries & Chet Hendrickson - Nature of Software Development


Ron and Chet told an interesting story about how product owners say that they didn't want to be product owners anymore. It was too stressful being this magical person that just knew how everything was supposed to work, what needed to be done and to get everything ready for developers to "just do teh codez".

One product owner suggested that they wanted the whole team to be the product owner. We are all cast members putting on a show. Every part of the vision should be shared.

Conclusion


I would really like to go to this conference again. The way the sessions were laid out were great and the speakers were top-notch. I was able to meet or listen to some people that I greatly admire in the industry. I feel that the software craftsmanship movement is important to our industry and I'm glad there are a lot of people out there that feel the same way.

I would also like to give a shout-out to my employer Ancestry.com for footing the bill as well. I always feel that it's my responsibility to keep myself trained but it's nice when your employer is willing to help out.

Tuesday, November 12, 2013

Updated Podcasts

Updated my podcast list today. If you're into podcasts, have a look. If I'm missing out on some amazing podcasts, please let me know.