10 questions for every developer

66
10 Questions I Ask Every Developer (and the answers)

Upload: jake-goldman

Post on 29-Nov-2014

2.763 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 10 questions for every developer

10 Questions I Ask Every Developer

(and the answers)

Page 2: 10 questions for every developer

Interviewed 175+ candidates.Responsible for hiring 45+.

Page 3: 10 questions for every developer

I’ve found some amazing people.

Page 4: 10 questions for every developer

I’ve also made mistakes. Lots of them.

Page 5: 10 questions for every developer

Not the developers you’re looking for.

Page 6: 10 questions for every developer

1. Does the candidate “get” the platform?

2. How much does he/she already know about building on WordPress?

3. Does the candidate think critically about his/her work?

Page 7: 10 questions for every developer

There’s not always one right answer.

... But there are better and worse answers.

... And there are some very wrong answers.

... Saying “I’m not familiar with that” is better than making something up.

Page 8: 10 questions for every developer

Part 1: Honestly, now, do you “Wordpress”?

Page 9: 10 questions for every developer

Tell me what a “hook” is, and talk about the two basic hooks in WordPress, and the difference

between them.

Question #1

Page 10: 10 questions for every developer

Tell me what a “hook” is, and talk about the two basic hooks in WordPress, and the difference between them.

Question #1

A killer feature that gets customers addicted.

wrong answer

Page 11: 10 questions for every developer

Tell me what a “hook” is, and talk about the two basic hooks in WordPress, and the difference between them.

Question #1

A way to extend WordPress. The two types are plug-ins and themes.

wrong answer

Page 12: 10 questions for every developer

Tell me what a “hook” is, and talk about the two basic hooks in WordPress, and the difference between them.

Question #1

A hook is a technique used to

alter or augment the behavior of software.

Page 13: 10 questions for every developer

Tell me what a “hook” is, and talk about the two basic hooks in WordPress, and the difference between them.

Question #1

WordPress has “action” hooks and

“filter” hooks.

Page 14: 10 questions for every developer

Tell me what a “hook” is, and talk about the two basic hooks in WordPress, and the difference between them.

Question #1

Action are hooks that WordPress launches at specific intervals during execution.

add_action  (  'hook_name',  'your_function_name',  [priority],  [accepted_args]  );

Page 15: 10 questions for every developer

Tell me what a “hook” is, and talk about the two basic hooks in WordPress, and the difference between them.

Question #1

Filters are functions that WordPress passes data through, at certain points in execution, just before taking some action

with the data.

add_filter  (  'hook_name',  'your_filter',  [priority],  [accepted_args]  );

Page 16: 10 questions for every developer

Explain what a “taxonomy” is.Question #2

Page 17: 10 questions for every developer

Explain what a “taxonomy” is.

Question #2

A way to preserve unused (dead) code.

wrong answer

Page 18: 10 questions for every developer

Explain what a “taxonomy” is.

Question #2

The various types of content in WordPress: posts, pages, media, menus, etc.

wrong answer

Page 19: 10 questions for every developer

Explain what a “taxonomy” is.

Question #2

A taxonomy is a way to group things together.

Page 20: 10 questions for every developer

Explain what a “taxonomy” is.

Question #2

WordPress posts have two default taxonomies: categories and tags.

Page 21: 10 questions for every developer

Explain what a “taxonomy” is.

Question #2

Bonus - a couple of lesser known default taxonomies.

Link Category

Navigation Menu

Page 22: 10 questions for every developer

Let’s say you see “wp_list_filter()” for the first time. How do you

figure out what this does?

Question #3

Page 23: 10 questions for every developer

Let’s say you see “wp_list_pluck()” for the first time. How do you figure out what this does?

Question #3

not wrong... but not great

Page 24: 10 questions for every developer

Let’s say you see “wp_list_pluck()” for the first time. How do you figure out what this does?

Question #3

not wrong... but not great

Page 25: 10 questions for every developer

Let’s say you see “wp_list_pluck()” for the first time. How do you figure out what this does?

Question #3

It’s open source. I look at the source.

Page 26: 10 questions for every developer

Part 2: So... you think you’re good at this.

Page 27: 10 questions for every developer

Explain what sanitizing and validating data means, and apply

that to WordPress.

Question #4

Page 28: 10 questions for every developer

Explain what sanitizing and validating data means, and apply that to WordPress.

Question #4

wrong answer

Checking database integrity and ensuring nothing has been corrupted.

Page 29: 10 questions for every developer

Explain what sanitizing and validating data means, and apply that to WordPress.

Question #4

good layman explanation... tell me more

Testing data to make sure it’s what you expected.

Page 30: 10 questions for every developer

Explain what sanitizing and validating data means, and apply that to WordPress.

Question #4

Untrusted data comes from many sources (users, third party sites, your own database!, ...) and all of it needs to be

validated both on input and output.

Page 31: 10 questions for every developer

Explain what sanitizing and validating data means, and apply that to WordPress.

Question #4

WordPress includes a large number of helper functions and methods to ensure that output and input data is safe.

HTML Fragments, e.g. wp_kses()

Text nodes, e.g. esc_html()

Attribute

Page 32: 10 questions for every developer

Explain what sanitizing and validating data means, and apply that to WordPress.

Question #4

Examples of validation / sanitizing helpers:

HTML: wp_kses( $string, $allowed_html, $allowed_protocols )

Text nodes & attributes: esc_html( $text )

URLs: esc_url( $url, (array) $protocols )

Database: wpdb->insert( $table, (array) $data )

Filesystem: validate_file( $filename, (array) $allowed_files )

Page 33: 10 questions for every developer

Say a client needs to selectively exclude posts from their blog

home. Specifically, how would you achieve that?

Question #5

Page 34: 10 questions for every developer

Say a client needs to selectively exclude posts from their blog home. Specifically, how would you achieve that?

Question #5

User approach: I would add a new category called “Exclude From Home” for the authors.

not bad... but not great

Page 35: 10 questions for every developer

Say a client needs to selectively exclude posts from their blog home. Specifically, how would you achieve that?

Question #5

User approach: I would add a new custom meta box with an “Exclude from home page” checkbox.

good enough answer

Page 36: 10 questions for every developer

Say a client needs to selectively exclude posts from their blog home. Specifically, how would you achieve that?

Question #5

User approach (bonus points): I would hook into post_submitbox_misc_actions to add a checkbox to

the “publish” box with an “Exclude from home” option.

Page 37: 10 questions for every developer

Say a client needs to selectively exclude posts from their blog home. Specifically, how would you achieve that?

Question #5

very wrong answer

Technical approach: Inside the loop, I would write an “if” statement checking my criteria around the post output.

Page 38: 10 questions for every developer

Say a client needs to selectively exclude posts from their blog home. Specifically, how would you achieve that?

Question #5

wrong answer

Technical approach: I would do a new post query at the top of my home.php template, excluding posts based on my

criteria.

Page 39: 10 questions for every developer

Say a client needs to selectively exclude posts from their blog home. Specifically, how would you achieve that?

Question #5

Technical approach: I would use pre_get_posts to hook into the post query, check if the query is for the blog home, and alter the query to exclude posts based on my approach

before it executes.function  exclude_category(  $query  )  {        if  (  $query-­‐>is_home()  &&  $query-­‐>is_main_query()  )  {                $query-­‐>set(  'cat',  '-­‐1,-­‐1347'  );        }}add_action(  'pre_get_posts',  'exclude_category'  );

Page 40: 10 questions for every developer

Tell me about your favorite function in WordPress.

Question #6

Page 41: 10 questions for every developer

media_sideload_image($file,  $post_id,  $desc);

Tell me about your favorite function / class / API in WordPress.

Question #6

Download an image from the specified URL and attach it to a post.

Page 42: 10 questions for every developer

human_time_diff(  $from,  $to  );

Tell me about your favorite function / class / API in WordPress.

Question #6

Determines the difference between two timestamps.The difference is returned in a human readable format such as "1

hour", "5 mins", "2 days".

Page 43: 10 questions for every developer

wp_list_pluck(  $list,  $field  );

Tell me about your favorite function / class / API in WordPress.

Question #6

Pluck a certain field out of each object in a list

Page 44: 10 questions for every developer

_doing_it_wrong(  $function,  $message,  $version  )

Tell me about your favorite function / class / API in WordPress.

Question #6

Trigger a user error if WP_DEBUG is true.(technically internal only)

Page 45: 10 questions for every developer

Say you needed to retrieve some data from a remote source once a

day. Tell me about some of the WordPress APIs you’d use.

Question #7

Page 46: 10 questions for every developer

I would use wp_schedule_event() (the WP-Cron APIs) to schedule the daily update.

add_action('my_hourly_event',  'do_this_hourly');

function  my_activation()  {   if  (  !wp_next_scheduled(  'my_hourly_event'  )  )  {     wp_schedule_event(  time(),  'hourly',  'my_hourly_event');   }}add_action('wp',  'my_activation');

function  do_this_hourly()  {   //  do  something  every  hour}

Say you needed to retrieve some data from a remote source once a day. Tell me about some of the WordPress APIs you’d use.

Question #7

Page 47: 10 questions for every developer

I would use wp_remote_post() (part of the WP HTTP API) to remotely fetch the data.

$response  =  wp_remote_post(  $url,  array(   'method'  =>  'POST',   'timeout'  =>  45,   'redirection'  =>  5,   'httpversion'  =>  '1.0',   'blocking'  =>  true,   'headers'  =>  array(),   'body'  =>  array(  'username'  =>  'bob',  'password'  =>  '1234xyz'  ),   'cookies'  =>  array()        ));

Say you needed to retrieve some data from a remote source once a day. Tell me about some of the WordPress APIs you’d use.

Question #7

Page 48: 10 questions for every developer

Extra credit: I would use the set_transient() (the Transients API) to cache the remote data after processing it.

set_transient(  'processed_remote_data',  $processed_data,  60*60*24  );

Say you needed to retrieve some data from a remote source once a day. Tell me about some of the WordPress APIs you’d use.

Question #7

Page 49: 10 questions for every developer

Part 3: So you can code. But can you think?

Page 50: 10 questions for every developer

Tell me what you the most interesting trend or “thing to

watch” in our space is.

Question #8

Page 51: 10 questions for every developer

Tell me what you the most interesting trend or “thing to watch” in our space is.

Question #8

Mobile first & the evolution of responsive design. The idea of “progressive enhancement”, and what designing for mobile

first really means. Image and advertising challenges in responsive technologies.

Page 52: 10 questions for every developer

Tell me what you the most interesting trend or “thing to watch” in our space is.

Question #8

HiDPI (“retina”). We still need to solve technical hurdles (e.g. image uploads in WordPress), and at some point this is going to be a major requirements. It seems like Responsive Design

circa 2009.

Page 53: 10 questions for every developer

Tell me what you the most interesting trend or “thing to watch” in our space is.

Question #8

Meaningful social media integration. Really innovative social media integration with content, especially within in e-

commerce, is still a relatively new frontier.

Page 54: 10 questions for every developer

Tell me what you the most interesting trend or “thing to watch” in our space is.

Question #8

Explosion of devices. There are new challenges we haven’t fully wrapped our heads around as we have so many different screen sizes and types emerges, each with - potentially -

their own browser quirks.

Page 55: 10 questions for every developer

Tell me what you the most interesting trend or “thing to watch” in our space is.

Question #8

Typography. Foundries are maturing, @font-face has essentially been universally adopted.

Page 56: 10 questions for every developer

What frustrates you about WordPress? What’s something that

you think needs to change?

Question #9

Page 57: 10 questions for every developer

What frustrates you about WordPress? What’s something that you think needs to change?

Question #9

Taxonomy / term architecture could be improved.No term meta data, strange artifacts due to way tags and

categories of the same name are linked.

Page 58: 10 questions for every developer

What frustrates you about WordPress? What’s something that you think needs to change?

Question #9

There are no formal methods to create direct relationships between two content objects (post objects).

Page 59: 10 questions for every developer

What frustrates you about WordPress? What’s something that you think needs to change?

Question #9

User interface for managing widgets and menus* can be clumsy. Awkward drag and scroll.

Page 60: 10 questions for every developer

What frustrates you about WordPress? What’s something that you think needs to change?

Question #9

Some areas don’t handle conflicts in plug-in well - for example registering two custom menu items in

the same spot.

Page 61: 10 questions for every developer

Why do you want to work day in and out with WordPress?

Question #10

Page 62: 10 questions for every developer

Why do you want to work day in and out with WordPress?

Question #10

“It’s become the dominant CMS on the web. And growing.”

Page 63: 10 questions for every developer

Why do you want to work day in and out with WordPress?

Question #10

“It’s the only platform where customers don’t call me back in every month asking for a retraining.”

Page 64: 10 questions for every developer

Why do you want to work day in and out with WordPress?

Question #10

“Because I believe in the freedoms in open source, and WordPress is an awesome open source platform.”

Page 65: 10 questions for every developer

Why do you want to work day in and out with WordPress?

Question #10

“The community.”

Page 66: 10 questions for every developer

10 Questions I Ask Every Developer

@jakemgold • @10up • 10up.com