10 questions for every developer

Post on 29-Nov-2014

2.763 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

10 Questions I Ask Every Developer

(and the answers)

Interviewed 175+ candidates.Responsible for hiring 45+.

I’ve found some amazing people.

I’ve also made mistakes. Lots of them.

Not the developers you’re looking for.

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?

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.

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

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

between them.

Question #1

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

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

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.

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.

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]  );

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]  );

Explain what a “taxonomy” is.Question #2

Explain what a “taxonomy” is.

Question #2

A way to preserve unused (dead) code.

wrong answer

Explain what a “taxonomy” is.

Question #2

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

wrong answer

Explain what a “taxonomy” is.

Question #2

A taxonomy is a way to group things together.

Explain what a “taxonomy” is.

Question #2

WordPress posts have two default taxonomies: categories and tags.

Explain what a “taxonomy” is.

Question #2

Bonus - a couple of lesser known default taxonomies.

Link Category

Navigation Menu

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

figure out what this does?

Question #3

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

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

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.

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

Explain what sanitizing and validating data means, and apply

that to WordPress.

Question #4

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.

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.

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.

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

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 )

Say a client needs to selectively exclude posts from their blog

home. Specifically, how would you achieve that?

Question #5

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

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

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.

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.

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.

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'  );

Tell me about your favorite function in WordPress.

Question #6

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.

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".

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

_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)

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

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

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

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

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

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

watch” in our space is.

Question #8

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.

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.

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.

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.

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.

What frustrates you about WordPress? What’s something that

you think needs to change?

Question #9

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.

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).

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.

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.

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

Question #10

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.”

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.”

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.”

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

Question #10

“The community.”

10 Questions I Ask Every Developer

@jakemgold • @10up • 10up.com

top related