SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
Source: http://abstrusegoose.com/432

Clean Code for WordPress
Michael Toppa

@mtoppa
April 20, 2013 WordCamp Nashville

It’s not just other people’s code, it’s your own code, 6 months later
But it doesn’t have to be this way

www.toppa.com
Mike Toppa
19 years of experience in web development, project management, and team management
✤

Author of 7 plugins at wordpress.org, dating back to 2006

✤

Given 5 WordCamp presentations

✤

Currently: Rails Engineer, ElectNext

✤

Previously:
✤

Director of Development, WebDevStudios - led NBC Latino WP VIP project

✤

Director of the 17 person Web Applications team at the U Penn School of Medicine

✤

Web developer at: Georgetown University, Stanford University, E*Trade, and Ask
Jeeves
Before we begin...
✤

Debut of the ElectNext Political Profiler

✤

The technology stack that powers it:
✤

✤

A Ruby on Rails application at electnext.com for generating them

✤

✤

WordPress plugin for embedding and displaying profiles

3rd party javascript for injecting the profiles in real-time

This application would be a nightmare without clean code

Same technology that power disqus and google analytics
My head was spinning enough already from switching between PHP, JS, and Ruby. Keeping
the code clean made keeping track of all the interactions coherent.
What is this talk about?

✤

Clean code for WordPress plugins

✤

Clean code for WordPress

✤

Clean code

I put “plugins” in the title to draw in developers
There are many aspects of coding for WordPress that are unique to WordPress, like the 2 talks
before me, about custom layout and customizing the admin area, and you have many
resources in the WordPress community for help with topics like that. So that’s not what I’m
here to talk about either
I’m here to talk about coding principles that apply across languages and across development
frameworks. I want to get you thinking about approaches to coding that will help you with
WordPress, and beyond WordPress as well
What is clean code?

Code formatting is important, but writing clean code is about much more than that - it’s
about how your code is organized, and how clearly it expresses its intent. Good organization
and expressiveness are the keys to writing code that is flexible, extensible, and maintainable
over time.
Clean code...
✤

“Does one thing well” - Bjarne Stroustrup

✤

“Reads like well written prose” - Grady Booch

✤

“Can be read and enhanced by a developer other than its original
author” - Dave Thomas

✤

“Always looks like it was written by someone who cares” - Michael
Feathers

✤

“Contains no duplication” - Ron Jeffries

✤

“Turns out to be pretty much what you expected” - Ward Cunningham

Quotes from “Clean Code” by Robert Martin

Stroustrup: inventor of C++
Booch: IBM chief scientist
Thomas: founder of Object Technology International
Feathers: author of Working Effectively with Legacy Code
Jeffries: co-creator of XP development
Cunnigham: inventor of Wikis
That sounds nice, but I have a deadline
I don't have time for clean code!
Do you want your emergency room doctor
to rush your surgery?
Do you want your account to rush
his work on your tax return?

Doctors take the Hippocratic oath and a set of practices to ensure they practice medicine
safely
Accounts are expected to do double entry booking, to avoid mistakes
Other professions have standards for what it means to practice that profession safely and
responsibly. When the pressure is on is when you most want them to adhere to their best
practices.
The software craftsmanship
movement

The software craftsmanship movement is intended to start a conversation about what it
means to write code responsibly and cleanly.
You don't have to agree with the ideas, but you do need to engage them.
Other professions - doctors, lawyers, plumbers, etc have various degrees of government
regulation. This will happen with software development if we don’t develop professional
standards of our own. The $440 million stock market meltdown last summer by Knight
Capital happened because they didn’t test their software properly. Everything from gas
pumps to medical devices rely on software.
Clean code is adaptable code

The more we rush, the more the code turns into a big ball of mud, making it harder and
harder to work with. Keeping the code clean lets us go faster, because clean code is flexible
code. Why is it exactly that trying to go fast ultimately makes us slower?
The ratio of time spent reading code versus
writing is well over 10 to 1.
Therefore, making code easy to read
makes it easier to write.

paraphrased from Clean Code

If you’re working quick and dirty, you’re not writing code that is readable
“We like to think we spend our time power typing,
but we actually spend most of our time
staring into the abyss.”
- Douglas Crockford
principal discoverer of JSON,
creator of JSLint

But we’re not really aware of how we’re spending our time. Going forward, think about the
hours you spend debugging, or trying to figure out messy code. When you’re trying to decide
whether you should spend a little more time writing code more cleanly, remember an ounce
of prevention is worth a pound of cure
10 ways to make your code clean
#1
You
are responsible for the quality of your code

It’s not up to the project manager or your boss.
What would your doctor say if you told her to skip washing her hands, because you’re in a
hurry?
What would your accountant say if you told him to save some time by no doing double-entry
bookkeeping?
Part of being a professional is being honest about how long it takes to do something well,
and not accepting the option to do it wrong.
#2 - Work in short cycles:
incremental and iterative

Source

Develop systems in small portions at a time (incremental), through repeated cycles (iterative),
and take advantage of what was learned in each cycle (for both features and implementation).
This workflow style complements the clean code style. Work on one thing, do it well, then
move on to the next thing.
This is what a project with short
cycles and feedback looks like

Source

This is an outline of what’s called an Agile workflow, and not all of them may apply to a
typical WP project
This is what a project without
feedback looks like

Source

“I find your lack of faith disturbing”

You don’t want this kind of relationship with your clients or your code
#3 - Use
meaningful
names

This visual is a great analogy for how you should name your variables and functions
The name of a variable, function,
or class should tell you
why it exists,
and what it does
Not good
$d; // elapsed time in days

Imagine a script full of variable names like this - it would be very difficult to understand.
Mental translating of obscure names to their real meaning distracts from our ability to get an
overall understanding of the code
The days when it was important to use short variable names to save memory space are long
gone
Automated minification tools can shrink javascript code for you when dealing with code being
transmitted over slow connections
Good
$elapsed_time_in_days;
$daysSinceCreation;
$days_since_modification;

This gives us the nouns for code that “reads like well written prose”
#4 - Write code that expresses
intent
public function set_numeric_thumbnail_size($requested_size = 'xsmall') {
if (array_key_exists($requested_size, $this->thumbnail_sizes_map)) {
$this->numeric_thumbnail_size = $this->thumbnail_sizes_map[$requested_size];
}
elseif (is_numeric($requested_size)) {
$this->numeric_thumbnail_size = $requested_size;
}
else {
throw New Exception(__('invalid thumbnail size requested', 'shashin'));
}
return $this->numeric_thumbnail_size;
}
Now we get to the verbs and sentences... Take a minute to read this. Even without knowing
the class or the properties, it's clear what this method does.
You should use a 21st century IDE, that auto-completes names for you and makes it easy to
rename. I use PHP Storm.
What don’t you see in this code?
#5
Comments are a red flag!
Code should speak for itself whenever possible

The revelation for me in learning clean code techniques is that code can be expressive. That it
really can “read like well written prose.”
Rather than relying on comments to explain your code, the code should explain itself
Comments become something you have to maintain, and if they become outdated and no
longer describe the current behavior of the code, they become dangerous lies
But they are sometimes necessary - for example, you may need to explain why you did
something a certain way
The point is to stop and think before you write a comment, and ask yourself if instead you
can make the code more expressive
#6

A common occurrence in software projects is “bit rot” - the code gets messier and buggier
over time.
But how about code that just keeps getting cleaner over time? You can get this by following
the “boy scout rule.” Keep your new code clean, and while you’re working it, spend a few
minutes cleaning up the code that it works with. Improve a variable name, break up a
function that’s too big, eliminate a small bit of duplication, etc. (rule 6.5 would be don’t
repeat yourself...)
It’s easier to keep your garden healthy and looking nice by weeding it for 10min every day
than waiting until it’s a huge overgrown mess.
#7

Do one thing, do it well, do it only
But what does it mean to do just one thing?
For methods, this typically means changing the value of only one variable
If you are passing more than 2 or 3 arguments into a function or method, you are probably
doing more than one thing
The more arguments you pass to a function, and the longer it is, the harder it is to test and
debug when something goes wrong
For classes, it means having a single conceptual responsibility. When projects get big, this is
how you keep them manageable.
Does this method follow the SRP?
public function set_numeric_thumbnail_size($requested_size = 'xsmall') {
if (array_key_exists($requested_size, $this->thumbnail_sizes_map)) {
$this->numeric_thumbnail_size = $this->thumbnail_sizes_map[$requested_size];
}
elseif (is_numeric($requested_size)) {
$this->numeric_thumbnail_size = $requested_size;
}
else {
throw New Exception(__('invalid thumbnail size requested', 'shashin'));
}
return $this->numeric_thumbnail_size;
}
It accepts one argument - that’s good
It changes only one value - that’s good
There are no side-effects - that’s good
If....elseif blocks are a red flag. There are 3 different cases being handled here. You could
technically call this a violation, but each conditional block contains only one line of code, so
breaking this down into more methods wouldn’t really help.
But if you see the same conditions being tested over and over in different functions, that’s a
sign to do some reorganizing
#8 - Don’t over-do it:
avoid needless complexity

The complexity of having 44 classes in my Shashin plugin is justified by its need for flexibility
You can support a new viewer or a new photo service simply by creating a new subclass. This
is much more maintainable and extensible than a single huge file with deeply nested
conditionals and unclear dependencies
But if I knew I would never need that kind of flexibility, there would be no justification for
creating these layers of abstraction – they would just be needless complexity
#9 - Independent Architecture

Why am I subjecting you to this awful image?
“Software architectures are structures that
support the use cases of the system...
Frameworks are tools to be used, not
architectures to be conformed to”
- Bob Martin
http://blog.8thlight.com/uncle-bob/2011/09/30/Screaming-Architecture.html

my attachment to the community - Philly WordCamp
But I’m also part of other communities
WordPress is essentially a framework, so this could read “WordPress is a tool to be used, not
an architecture to be conformed to”
This is from a blog post called “screaming architecture”
Looking at Shashin, its files and code scream “photo management and display!”, with names
like PicasaSynchronizer and PhotoDisplayer. It does not scream “WordPress plugin”
The fact that it is a WordPress plugin is incidental to its design. In fact I used a design called
the facade pattern, which removes most of the direct dependencies on WordPress. This makes
it possible to re-use outside of WordPress if I wanted to.
Community and Architecture
✤

Why does this matter?

✤

WordPress has an architecture that’s causing its best practices to
diverge from the best practices of the broader software community

✤

The WordPress community is so big that it’s easy to talk only to
ourselves

✤

Developers in Ruby/Rails, Java/Spring, Python/Django, etc
regularly intermingle at conferences and learn from each other

✤

I don’t see a compelling reason for WordPress to continue forever on a
divergent path, and doing so means lost opportunities

I wrote about this on my blog a few weeks ago
I’m talking about the Singleton pattern, continuing reliance on global variables, writing
integration tests but calling them unit tests (and having an architecture that precludes actual
unit testing), etc.
WordPress experience is not a good preparation for work outside of WordPress
#10 - Practice, practice, practice

I added this slide this morning, after seeing Eric Brace & Peter Cooper last night at the Station
Inn
Musicians don’t play only when they’re on stage
To get good at something you need time to refine your craft, when you’re not under pressure
to perform
Imagine if downloading wordpress gave you blisters
[my working on bus example]
Any questions?
Michael Toppa

@mtoppa
April 20, 2013 WordCamp Nashville

www.toppa.com

Weitere ähnliche Inhalte

Was ist angesagt?

Everyones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionEveryones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionColdFusionConference
 
What if-your-application-could-speak
What if-your-application-could-speakWhat if-your-application-could-speak
What if-your-application-could-speakMarcos Vinícius
 
Better and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and EnjoymentBetter and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and EnjoymentChris Holland
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonifiedChristian Heilmann
 
Design patterns - The Good, the Bad, and the Anti-Pattern
Design patterns -  The Good, the Bad, and the Anti-PatternDesign patterns -  The Good, the Bad, and the Anti-Pattern
Design patterns - The Good, the Bad, and the Anti-PatternBarry O Sullivan
 
XML for Humans: Non-geek Discussion of a Geek-chic Topic
XML for Humans: Non-geek Discussion of a Geek-chic TopicXML for Humans: Non-geek Discussion of a Geek-chic Topic
XML for Humans: Non-geek Discussion of a Geek-chic TopicPublishing Smarter
 
Anatomy of a Virtual Self-Study Group
Anatomy of a Virtual Self-Study GroupAnatomy of a Virtual Self-Study Group
Anatomy of a Virtual Self-Study GroupGene Babon
 
Cleaning up your codebase with a clean architecture
Cleaning up your codebase with a clean architectureCleaning up your codebase with a clean architecture
Cleaning up your codebase with a clean architectureBarry O Sullivan
 
This Is not a Place of Honor
This Is not a Place of HonorThis Is not a Place of Honor
This Is not a Place of HonorJeff Eaton
 
Untangling spring week1
Untangling spring week1Untangling spring week1
Untangling spring week1Derek Jacoby
 
How microservices fail, and what to do about it
How microservices fail, and what to do about itHow microservices fail, and what to do about it
How microservices fail, and what to do about itRichard Rodger
 
Java script basics for beginners
Java script basics for beginners  Java script basics for beginners
Java script basics for beginners Ketan Raval
 
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...Prasid Pathak
 
IDX Broker Research & Development by Derek Rose
IDX Broker Research & Development by Derek RoseIDX Broker Research & Development by Derek Rose
IDX Broker Research & Development by Derek RoseIDX Broker
 
Untangling the web week1
Untangling the web week1Untangling the web week1
Untangling the web week1Derek Jacoby
 
A sweet taste of clean code and software design
A sweet taste of clean code and software designA sweet taste of clean code and software design
A sweet taste of clean code and software designKfir Bloch
 
Organizational Access
Organizational AccessOrganizational Access
Organizational AccessMark Farmer
 
Untangling the web11
Untangling the web11Untangling the web11
Untangling the web11Derek Jacoby
 

Was ist angesagt? (20)

Everyones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionEveryones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusion
 
What if-your-application-could-speak
What if-your-application-could-speakWhat if-your-application-could-speak
What if-your-application-could-speak
 
Testing Content
Testing ContentTesting Content
Testing Content
 
Better and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and EnjoymentBetter and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and Enjoyment
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonified
 
Design patterns - The Good, the Bad, and the Anti-Pattern
Design patterns -  The Good, the Bad, and the Anti-PatternDesign patterns -  The Good, the Bad, and the Anti-Pattern
Design patterns - The Good, the Bad, and the Anti-Pattern
 
XML for Humans: Non-geek Discussion of a Geek-chic Topic
XML for Humans: Non-geek Discussion of a Geek-chic TopicXML for Humans: Non-geek Discussion of a Geek-chic Topic
XML for Humans: Non-geek Discussion of a Geek-chic Topic
 
Anatomy of a Virtual Self-Study Group
Anatomy of a Virtual Self-Study GroupAnatomy of a Virtual Self-Study Group
Anatomy of a Virtual Self-Study Group
 
Cleaning up your codebase with a clean architecture
Cleaning up your codebase with a clean architectureCleaning up your codebase with a clean architecture
Cleaning up your codebase with a clean architecture
 
This Is not a Place of Honor
This Is not a Place of HonorThis Is not a Place of Honor
This Is not a Place of Honor
 
Untangling spring week1
Untangling spring week1Untangling spring week1
Untangling spring week1
 
How microservices fail, and what to do about it
How microservices fail, and what to do about itHow microservices fail, and what to do about it
How microservices fail, and what to do about it
 
Java script basics for beginners
Java script basics for beginners  Java script basics for beginners
Java script basics for beginners
 
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
 
IDX Broker Research & Development by Derek Rose
IDX Broker Research & Development by Derek RoseIDX Broker Research & Development by Derek Rose
IDX Broker Research & Development by Derek Rose
 
Java script hello world
Java script hello worldJava script hello world
Java script hello world
 
Untangling the web week1
Untangling the web week1Untangling the web week1
Untangling the web week1
 
A sweet taste of clean code and software design
A sweet taste of clean code and software designA sweet taste of clean code and software design
A sweet taste of clean code and software design
 
Organizational Access
Organizational AccessOrganizational Access
Organizational Access
 
Untangling the web11
Untangling the web11Untangling the web11
Untangling the web11
 

Andere mochten auch

Dependency Injection for Wordpress
Dependency Injection for WordpressDependency Injection for Wordpress
Dependency Injection for Wordpressmtoppa
 
Personal Branding através dos Blogs
Personal Branding através dos BlogsPersonal Branding através dos Blogs
Personal Branding através dos BlogsPriscilla Saldanha
 
Introduction to WordPress Multisite
Introduction to WordPress MultisiteIntroduction to WordPress Multisite
Introduction to WordPress MultisiteCraig Taylor
 
Make Cash. Using Open Source. And WordPress.
Make Cash. Using Open Source. And WordPress.Make Cash. Using Open Source. And WordPress.
Make Cash. Using Open Source. And WordPress.sogrady
 
Supporting Wordpress
Supporting WordpressSupporting Wordpress
Supporting Wordpressmasonjames
 
Power Up Your Non-Profit Website With WordPress
Power Up Your Non-Profit Website With WordPressPower Up Your Non-Profit Website With WordPress
Power Up Your Non-Profit Website With WordPressRaymund Mitchell
 
Website Performance, Engagement, and Leads
Website Performance, Engagement, and LeadsWebsite Performance, Engagement, and Leads
Website Performance, Engagement, and LeadsTrust EMedia
 
Using Theme Frameworks for rapid development and sustainability
Using Theme Frameworks for rapid development and sustainabilityUsing Theme Frameworks for rapid development and sustainability
Using Theme Frameworks for rapid development and sustainabilityJoel Norris
 
Developing for Success -or- Any Fool Can Do This
Developing for Success -or- Any Fool Can Do ThisDeveloping for Success -or- Any Fool Can Do This
Developing for Success -or- Any Fool Can Do ThisBrian Richards
 
Working Off Grid & Remote
Working Off Grid & RemoteWorking Off Grid & Remote
Working Off Grid & Remotetravistotz
 
Ten Things You Should Know About WordPress
Ten Things You Should Know About WordPressTen Things You Should Know About WordPress
Ten Things You Should Know About WordPresssereedmedia
 
Make WordPress Fit: The Cinderella Shoe Approach to Custom Theming
Make WordPress Fit: The Cinderella Shoe Approach to Custom ThemingMake WordPress Fit: The Cinderella Shoe Approach to Custom Theming
Make WordPress Fit: The Cinderella Shoe Approach to Custom ThemingIntrepidRealist
 
Object Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin DevelopmentObject Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin Developmentmtoppa
 
Word Camp Philly 2014: Good Content
Word Camp Philly 2014: Good ContentWord Camp Philly 2014: Good Content
Word Camp Philly 2014: Good ContentVicki Boykis
 
WortdPress Child themes: Why and How
WortdPress Child themes: Why and HowWortdPress Child themes: Why and How
WortdPress Child themes: Why and HowPaul Bearne
 
A Beginner's Guide to Popping the Bonnet and Getting Your Hands Dirty
A Beginner's Guide to Popping the Bonnet and Getting Your Hands DirtyA Beginner's Guide to Popping the Bonnet and Getting Your Hands Dirty
A Beginner's Guide to Popping the Bonnet and Getting Your Hands DirtyKenneth Scott Huntley
 
L’ascesa della geolocalizzazione. Perché mapperemo sempre di più e come lo fa...
L’ascesa della geolocalizzazione. Perché mapperemo sempre di più e come lo fa...L’ascesa della geolocalizzazione. Perché mapperemo sempre di più e come lo fa...
L’ascesa della geolocalizzazione. Perché mapperemo sempre di più e come lo fa...GGDBologna
 
The Capitalist in the Co-Op: The Art & Science of the Premium WordPress Business
The Capitalist in the Co-Op: The Art & Science of the Premium WordPress BusinessThe Capitalist in the Co-Op: The Art & Science of the Premium WordPress Business
The Capitalist in the Co-Op: The Art & Science of the Premium WordPress BusinessShane Pearlman
 
What's the plan for your master brand?
What's the plan for your master brand?What's the plan for your master brand?
What's the plan for your master brand?Fly Solo Media Agency
 
Simplicity
SimplicitySimplicity
Simplicitykwight
 

Andere mochten auch (20)

Dependency Injection for Wordpress
Dependency Injection for WordpressDependency Injection for Wordpress
Dependency Injection for Wordpress
 
Personal Branding através dos Blogs
Personal Branding através dos BlogsPersonal Branding através dos Blogs
Personal Branding através dos Blogs
 
Introduction to WordPress Multisite
Introduction to WordPress MultisiteIntroduction to WordPress Multisite
Introduction to WordPress Multisite
 
Make Cash. Using Open Source. And WordPress.
Make Cash. Using Open Source. And WordPress.Make Cash. Using Open Source. And WordPress.
Make Cash. Using Open Source. And WordPress.
 
Supporting Wordpress
Supporting WordpressSupporting Wordpress
Supporting Wordpress
 
Power Up Your Non-Profit Website With WordPress
Power Up Your Non-Profit Website With WordPressPower Up Your Non-Profit Website With WordPress
Power Up Your Non-Profit Website With WordPress
 
Website Performance, Engagement, and Leads
Website Performance, Engagement, and LeadsWebsite Performance, Engagement, and Leads
Website Performance, Engagement, and Leads
 
Using Theme Frameworks for rapid development and sustainability
Using Theme Frameworks for rapid development and sustainabilityUsing Theme Frameworks for rapid development and sustainability
Using Theme Frameworks for rapid development and sustainability
 
Developing for Success -or- Any Fool Can Do This
Developing for Success -or- Any Fool Can Do ThisDeveloping for Success -or- Any Fool Can Do This
Developing for Success -or- Any Fool Can Do This
 
Working Off Grid & Remote
Working Off Grid & RemoteWorking Off Grid & Remote
Working Off Grid & Remote
 
Ten Things You Should Know About WordPress
Ten Things You Should Know About WordPressTen Things You Should Know About WordPress
Ten Things You Should Know About WordPress
 
Make WordPress Fit: The Cinderella Shoe Approach to Custom Theming
Make WordPress Fit: The Cinderella Shoe Approach to Custom ThemingMake WordPress Fit: The Cinderella Shoe Approach to Custom Theming
Make WordPress Fit: The Cinderella Shoe Approach to Custom Theming
 
Object Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin DevelopmentObject Oriented Programming for WordPress Plugin Development
Object Oriented Programming for WordPress Plugin Development
 
Word Camp Philly 2014: Good Content
Word Camp Philly 2014: Good ContentWord Camp Philly 2014: Good Content
Word Camp Philly 2014: Good Content
 
WortdPress Child themes: Why and How
WortdPress Child themes: Why and HowWortdPress Child themes: Why and How
WortdPress Child themes: Why and How
 
A Beginner's Guide to Popping the Bonnet and Getting Your Hands Dirty
A Beginner's Guide to Popping the Bonnet and Getting Your Hands DirtyA Beginner's Guide to Popping the Bonnet and Getting Your Hands Dirty
A Beginner's Guide to Popping the Bonnet and Getting Your Hands Dirty
 
L’ascesa della geolocalizzazione. Perché mapperemo sempre di più e come lo fa...
L’ascesa della geolocalizzazione. Perché mapperemo sempre di più e come lo fa...L’ascesa della geolocalizzazione. Perché mapperemo sempre di più e come lo fa...
L’ascesa della geolocalizzazione. Perché mapperemo sempre di più e come lo fa...
 
The Capitalist in the Co-Op: The Art & Science of the Premium WordPress Business
The Capitalist in the Co-Op: The Art & Science of the Premium WordPress BusinessThe Capitalist in the Co-Op: The Art & Science of the Premium WordPress Business
The Capitalist in the Co-Op: The Art & Science of the Premium WordPress Business
 
What's the plan for your master brand?
What's the plan for your master brand?What's the plan for your master brand?
What's the plan for your master brand?
 
Simplicity
SimplicitySimplicity
Simplicity
 

Ähnlich wie WordCamp Nashville: Clean Code for WordPress

Clean Code Software Engineering
Clean Code Software Engineering Clean Code Software Engineering
Clean Code Software Engineering Inocentshuja Ahmad
 
Agile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovAgile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovSvetlin Nakov
 
Software quality
Software qualitySoftware quality
Software quality5minpause
 
Agile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingAgile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingUtkarsh Khare
 
Code Quality Makes Your Job Easier
Code Quality Makes Your Job EasierCode Quality Makes Your Job Easier
Code Quality Makes Your Job EasierTonya Mork
 
Managing and evolving JavaScript Code
Managing and evolving JavaScript CodeManaging and evolving JavaScript Code
Managing and evolving JavaScript CodeJean Carlo Emer
 
Form Function Class 6, Manila, Philippines 14/11/2015
Form Function Class 6, Manila, Philippines 14/11/2015Form Function Class 6, Manila, Philippines 14/11/2015
Form Function Class 6, Manila, Philippines 14/11/2015Holger Bartel
 
Writing Clean Code
Writing Clean CodeWriting Clean Code
Writing Clean CodeNascenia IT
 
Finding balance of DDD while your application grows
Finding balance of DDD while your application growsFinding balance of DDD while your application grows
Finding balance of DDD while your application growsCarolina Karklis
 
Planning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsPlanning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsChristian Heilmann
 
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...Abdelkrim Boujraf
 
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkTaming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkJoseph Yoder
 
Resisting The Feature Creature
Resisting The Feature CreatureResisting The Feature Creature
Resisting The Feature CreatureChristian Heilmann
 
Importance of Documentation for programmers
Importance of Documentation for programmers Importance of Documentation for programmers
Importance of Documentation for programmers NASSCOM
 
Front End: Building Future-Proof eCommerce Sites.pdf
Front End: Building Future-Proof eCommerce Sites.pdfFront End: Building Future-Proof eCommerce Sites.pdf
Front End: Building Future-Proof eCommerce Sites.pdfWP Engine
 
9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdfOprim Solutions
 
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...Juraj Martinka
 

Ähnlich wie WordCamp Nashville: Clean Code for WordPress (20)

Put to the Test
Put to the TestPut to the Test
Put to the Test
 
Clean Code Software Engineering
Clean Code Software Engineering Clean Code Software Engineering
Clean Code Software Engineering
 
Agile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovAgile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin Nakov
 
Software quality
Software qualitySoftware quality
Software quality
 
Agile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingAgile Methodologies And Extreme Programming
Agile Methodologies And Extreme Programming
 
Code Quality Makes Your Job Easier
Code Quality Makes Your Job EasierCode Quality Makes Your Job Easier
Code Quality Makes Your Job Easier
 
Managing and evolving JavaScript Code
Managing and evolving JavaScript CodeManaging and evolving JavaScript Code
Managing and evolving JavaScript Code
 
Form Function Class 6, Manila, Philippines 14/11/2015
Form Function Class 6, Manila, Philippines 14/11/2015Form Function Class 6, Manila, Philippines 14/11/2015
Form Function Class 6, Manila, Philippines 14/11/2015
 
Writing Clean Code
Writing Clean CodeWriting Clean Code
Writing Clean Code
 
Finding balance of DDD while your application grows
Finding balance of DDD while your application growsFinding balance of DDD while your application grows
Finding balance of DDD while your application grows
 
Planning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsPlanning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teams
 
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
Test-Driven Developments are Inefficient; Behavior-Driven Developments are a ...
 
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard WorkTaming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
 
Resisting The Feature Creature
Resisting The Feature CreatureResisting The Feature Creature
Resisting The Feature Creature
 
Importance of Documentation for programmers
Importance of Documentation for programmers Importance of Documentation for programmers
Importance of Documentation for programmers
 
Front End: Building Future-Proof eCommerce Sites.pdf
Front End: Building Future-Proof eCommerce Sites.pdfFront End: Building Future-Proof eCommerce Sites.pdf
Front End: Building Future-Proof eCommerce Sites.pdf
 
Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD
 
9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf
 
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
 
Quick Intro to Clean Coding
Quick Intro to Clean CodingQuick Intro to Clean Coding
Quick Intro to Clean Coding
 

Mehr von mtoppa

RubyConf 2022 - From beginner to expert, and back again
RubyConf 2022 - From beginner to expert, and back againRubyConf 2022 - From beginner to expert, and back again
RubyConf 2022 - From beginner to expert, and back againmtoppa
 
RailsConf 2022 - Upgrading Rails: The Dual Boot Way
RailsConf 2022 - Upgrading Rails: The Dual Boot WayRailsConf 2022 - Upgrading Rails: The Dual Boot Way
RailsConf 2022 - Upgrading Rails: The Dual Boot Waymtoppa
 
Applying Omotenashi (Japanese customer service) to your work
Applying Omotenashi (Japanese customer service) to your workApplying Omotenashi (Japanese customer service) to your work
Applying Omotenashi (Japanese customer service) to your workmtoppa
 
Talking to strangers causes train wrecks
Talking to strangers causes train wrecksTalking to strangers causes train wrecks
Talking to strangers causes train wrecksmtoppa
 
A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between: accessib...
A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between:  accessib...A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between:  accessib...
A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between: accessib...mtoppa
 
The promise and peril of Agile and Lean practices
The promise and peril of Agile and Lean practicesThe promise and peril of Agile and Lean practices
The promise and peril of Agile and Lean practicesmtoppa
 
Why do planes crash? Lessons for junior and senior developers
Why do planes crash? Lessons for junior and senior developersWhy do planes crash? Lessons for junior and senior developers
Why do planes crash? Lessons for junior and senior developersmtoppa
 
Boston Ruby Meetup: The promise and peril of Agile and Lean practices
Boston Ruby Meetup: The promise and peril of Agile and Lean practicesBoston Ruby Meetup: The promise and peril of Agile and Lean practices
Boston Ruby Meetup: The promise and peril of Agile and Lean practicesmtoppa
 
A real-life overview of Agile and Scrum
A real-life overview of Agile and ScrumA real-life overview of Agile and Scrum
A real-life overview of Agile and Scrummtoppa
 
WordCamp Nashville 2016: The promise and peril of Agile and Lean practices
WordCamp Nashville 2016: The promise and peril of Agile and Lean practicesWordCamp Nashville 2016: The promise and peril of Agile and Lean practices
WordCamp Nashville 2016: The promise and peril of Agile and Lean practicesmtoppa
 
Dependency Injection for PHP
Dependency Injection for PHPDependency Injection for PHP
Dependency Injection for PHPmtoppa
 
WordCamp Boston 2015: Agile Contracts for WordPress Consultants
WordCamp Boston 2015: Agile Contracts for WordPress ConsultantsWordCamp Boston 2015: Agile Contracts for WordPress Consultants
WordCamp Boston 2015: Agile Contracts for WordPress Consultantsmtoppa
 
Rails testing: factories or fixtures?
Rails testing: factories or fixtures?Rails testing: factories or fixtures?
Rails testing: factories or fixtures?mtoppa
 
WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?
WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?
WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?mtoppa
 
A real-life overview of Agile workflow practices
A real-life overview of Agile workflow practicesA real-life overview of Agile workflow practices
A real-life overview of Agile workflow practicesmtoppa
 
Why Agile? Why Now?
Why Agile? Why Now?Why Agile? Why Now?
Why Agile? Why Now?mtoppa
 
Clean code for WordPress
Clean code for WordPressClean code for WordPress
Clean code for WordPressmtoppa
 
Dependency Inversion and Dependency Injection in PHP
Dependency Inversion and Dependency Injection in PHPDependency Inversion and Dependency Injection in PHP
Dependency Inversion and Dependency Injection in PHPmtoppa
 
Why Do Planes Crash?
Why Do Planes Crash?Why Do Planes Crash?
Why Do Planes Crash?mtoppa
 
Why Scrum Why Now
Why Scrum Why NowWhy Scrum Why Now
Why Scrum Why Nowmtoppa
 

Mehr von mtoppa (20)

RubyConf 2022 - From beginner to expert, and back again
RubyConf 2022 - From beginner to expert, and back againRubyConf 2022 - From beginner to expert, and back again
RubyConf 2022 - From beginner to expert, and back again
 
RailsConf 2022 - Upgrading Rails: The Dual Boot Way
RailsConf 2022 - Upgrading Rails: The Dual Boot WayRailsConf 2022 - Upgrading Rails: The Dual Boot Way
RailsConf 2022 - Upgrading Rails: The Dual Boot Way
 
Applying Omotenashi (Japanese customer service) to your work
Applying Omotenashi (Japanese customer service) to your workApplying Omotenashi (Japanese customer service) to your work
Applying Omotenashi (Japanese customer service) to your work
 
Talking to strangers causes train wrecks
Talking to strangers causes train wrecksTalking to strangers causes train wrecks
Talking to strangers causes train wrecks
 
A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between: accessib...
A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between:  accessib...A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between:  accessib...
A11Y? I18N? L10N? UTF8? WTF? Understanding the connections between: accessib...
 
The promise and peril of Agile and Lean practices
The promise and peril of Agile and Lean practicesThe promise and peril of Agile and Lean practices
The promise and peril of Agile and Lean practices
 
Why do planes crash? Lessons for junior and senior developers
Why do planes crash? Lessons for junior and senior developersWhy do planes crash? Lessons for junior and senior developers
Why do planes crash? Lessons for junior and senior developers
 
Boston Ruby Meetup: The promise and peril of Agile and Lean practices
Boston Ruby Meetup: The promise and peril of Agile and Lean practicesBoston Ruby Meetup: The promise and peril of Agile and Lean practices
Boston Ruby Meetup: The promise and peril of Agile and Lean practices
 
A real-life overview of Agile and Scrum
A real-life overview of Agile and ScrumA real-life overview of Agile and Scrum
A real-life overview of Agile and Scrum
 
WordCamp Nashville 2016: The promise and peril of Agile and Lean practices
WordCamp Nashville 2016: The promise and peril of Agile and Lean practicesWordCamp Nashville 2016: The promise and peril of Agile and Lean practices
WordCamp Nashville 2016: The promise and peril of Agile and Lean practices
 
Dependency Injection for PHP
Dependency Injection for PHPDependency Injection for PHP
Dependency Injection for PHP
 
WordCamp Boston 2015: Agile Contracts for WordPress Consultants
WordCamp Boston 2015: Agile Contracts for WordPress ConsultantsWordCamp Boston 2015: Agile Contracts for WordPress Consultants
WordCamp Boston 2015: Agile Contracts for WordPress Consultants
 
Rails testing: factories or fixtures?
Rails testing: factories or fixtures?Rails testing: factories or fixtures?
Rails testing: factories or fixtures?
 
WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?
WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?
WordCamp Lancaster 2014: A11Y? I18N? L10N? UTF8? WTF?
 
A real-life overview of Agile workflow practices
A real-life overview of Agile workflow practicesA real-life overview of Agile workflow practices
A real-life overview of Agile workflow practices
 
Why Agile? Why Now?
Why Agile? Why Now?Why Agile? Why Now?
Why Agile? Why Now?
 
Clean code for WordPress
Clean code for WordPressClean code for WordPress
Clean code for WordPress
 
Dependency Inversion and Dependency Injection in PHP
Dependency Inversion and Dependency Injection in PHPDependency Inversion and Dependency Injection in PHP
Dependency Inversion and Dependency Injection in PHP
 
Why Do Planes Crash?
Why Do Planes Crash?Why Do Planes Crash?
Why Do Planes Crash?
 
Why Scrum Why Now
Why Scrum Why NowWhy Scrum Why Now
Why Scrum Why Now
 

Kürzlich hochgeladen

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Kürzlich hochgeladen (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

WordCamp Nashville: Clean Code for WordPress

  • 1. Source: http://abstrusegoose.com/432 Clean Code for WordPress Michael Toppa @mtoppa April 20, 2013 WordCamp Nashville It’s not just other people’s code, it’s your own code, 6 months later But it doesn’t have to be this way www.toppa.com
  • 2. Mike Toppa 19 years of experience in web development, project management, and team management ✤ Author of 7 plugins at wordpress.org, dating back to 2006 ✤ Given 5 WordCamp presentations ✤ Currently: Rails Engineer, ElectNext ✤ Previously: ✤ Director of Development, WebDevStudios - led NBC Latino WP VIP project ✤ Director of the 17 person Web Applications team at the U Penn School of Medicine ✤ Web developer at: Georgetown University, Stanford University, E*Trade, and Ask Jeeves
  • 3. Before we begin... ✤ Debut of the ElectNext Political Profiler ✤ The technology stack that powers it: ✤ ✤ A Ruby on Rails application at electnext.com for generating them ✤ ✤ WordPress plugin for embedding and displaying profiles 3rd party javascript for injecting the profiles in real-time This application would be a nightmare without clean code Same technology that power disqus and google analytics My head was spinning enough already from switching between PHP, JS, and Ruby. Keeping the code clean made keeping track of all the interactions coherent.
  • 4. What is this talk about? ✤ Clean code for WordPress plugins ✤ Clean code for WordPress ✤ Clean code I put “plugins” in the title to draw in developers There are many aspects of coding for WordPress that are unique to WordPress, like the 2 talks before me, about custom layout and customizing the admin area, and you have many resources in the WordPress community for help with topics like that. So that’s not what I’m here to talk about either I’m here to talk about coding principles that apply across languages and across development frameworks. I want to get you thinking about approaches to coding that will help you with WordPress, and beyond WordPress as well
  • 5. What is clean code? Code formatting is important, but writing clean code is about much more than that - it’s about how your code is organized, and how clearly it expresses its intent. Good organization and expressiveness are the keys to writing code that is flexible, extensible, and maintainable over time.
  • 6. Clean code... ✤ “Does one thing well” - Bjarne Stroustrup ✤ “Reads like well written prose” - Grady Booch ✤ “Can be read and enhanced by a developer other than its original author” - Dave Thomas ✤ “Always looks like it was written by someone who cares” - Michael Feathers ✤ “Contains no duplication” - Ron Jeffries ✤ “Turns out to be pretty much what you expected” - Ward Cunningham Quotes from “Clean Code” by Robert Martin Stroustrup: inventor of C++ Booch: IBM chief scientist Thomas: founder of Object Technology International Feathers: author of Working Effectively with Legacy Code Jeffries: co-creator of XP development Cunnigham: inventor of Wikis
  • 7. That sounds nice, but I have a deadline I don't have time for clean code!
  • 8. Do you want your emergency room doctor to rush your surgery? Do you want your account to rush his work on your tax return? Doctors take the Hippocratic oath and a set of practices to ensure they practice medicine safely Accounts are expected to do double entry booking, to avoid mistakes Other professions have standards for what it means to practice that profession safely and responsibly. When the pressure is on is when you most want them to adhere to their best practices.
  • 9. The software craftsmanship movement The software craftsmanship movement is intended to start a conversation about what it means to write code responsibly and cleanly. You don't have to agree with the ideas, but you do need to engage them. Other professions - doctors, lawyers, plumbers, etc have various degrees of government regulation. This will happen with software development if we don’t develop professional standards of our own. The $440 million stock market meltdown last summer by Knight Capital happened because they didn’t test their software properly. Everything from gas pumps to medical devices rely on software.
  • 10. Clean code is adaptable code The more we rush, the more the code turns into a big ball of mud, making it harder and harder to work with. Keeping the code clean lets us go faster, because clean code is flexible code. Why is it exactly that trying to go fast ultimately makes us slower?
  • 11. The ratio of time spent reading code versus writing is well over 10 to 1. Therefore, making code easy to read makes it easier to write. paraphrased from Clean Code If you’re working quick and dirty, you’re not writing code that is readable
  • 12. “We like to think we spend our time power typing, but we actually spend most of our time staring into the abyss.” - Douglas Crockford principal discoverer of JSON, creator of JSLint But we’re not really aware of how we’re spending our time. Going forward, think about the hours you spend debugging, or trying to figure out messy code. When you’re trying to decide whether you should spend a little more time writing code more cleanly, remember an ounce of prevention is worth a pound of cure
  • 13. 10 ways to make your code clean
  • 14. #1 You are responsible for the quality of your code It’s not up to the project manager or your boss. What would your doctor say if you told her to skip washing her hands, because you’re in a hurry? What would your accountant say if you told him to save some time by no doing double-entry bookkeeping? Part of being a professional is being honest about how long it takes to do something well, and not accepting the option to do it wrong.
  • 15. #2 - Work in short cycles: incremental and iterative Source Develop systems in small portions at a time (incremental), through repeated cycles (iterative), and take advantage of what was learned in each cycle (for both features and implementation). This workflow style complements the clean code style. Work on one thing, do it well, then move on to the next thing.
  • 16. This is what a project with short cycles and feedback looks like Source This is an outline of what’s called an Agile workflow, and not all of them may apply to a typical WP project
  • 17. This is what a project without feedback looks like Source “I find your lack of faith disturbing” You don’t want this kind of relationship with your clients or your code
  • 18. #3 - Use meaningful names This visual is a great analogy for how you should name your variables and functions
  • 19. The name of a variable, function, or class should tell you why it exists, and what it does
  • 20. Not good $d; // elapsed time in days Imagine a script full of variable names like this - it would be very difficult to understand. Mental translating of obscure names to their real meaning distracts from our ability to get an overall understanding of the code The days when it was important to use short variable names to save memory space are long gone Automated minification tools can shrink javascript code for you when dealing with code being transmitted over slow connections
  • 21. Good $elapsed_time_in_days; $daysSinceCreation; $days_since_modification; This gives us the nouns for code that “reads like well written prose”
  • 22. #4 - Write code that expresses intent public function set_numeric_thumbnail_size($requested_size = 'xsmall') { if (array_key_exists($requested_size, $this->thumbnail_sizes_map)) { $this->numeric_thumbnail_size = $this->thumbnail_sizes_map[$requested_size]; } elseif (is_numeric($requested_size)) { $this->numeric_thumbnail_size = $requested_size; } else { throw New Exception(__('invalid thumbnail size requested', 'shashin')); } return $this->numeric_thumbnail_size; } Now we get to the verbs and sentences... Take a minute to read this. Even without knowing the class or the properties, it's clear what this method does. You should use a 21st century IDE, that auto-completes names for you and makes it easy to rename. I use PHP Storm. What don’t you see in this code?
  • 23. #5 Comments are a red flag! Code should speak for itself whenever possible The revelation for me in learning clean code techniques is that code can be expressive. That it really can “read like well written prose.” Rather than relying on comments to explain your code, the code should explain itself Comments become something you have to maintain, and if they become outdated and no longer describe the current behavior of the code, they become dangerous lies But they are sometimes necessary - for example, you may need to explain why you did something a certain way The point is to stop and think before you write a comment, and ask yourself if instead you can make the code more expressive
  • 24. #6 A common occurrence in software projects is “bit rot” - the code gets messier and buggier over time. But how about code that just keeps getting cleaner over time? You can get this by following the “boy scout rule.” Keep your new code clean, and while you’re working it, spend a few minutes cleaning up the code that it works with. Improve a variable name, break up a function that’s too big, eliminate a small bit of duplication, etc. (rule 6.5 would be don’t repeat yourself...) It’s easier to keep your garden healthy and looking nice by weeding it for 10min every day than waiting until it’s a huge overgrown mess.
  • 25. #7 Do one thing, do it well, do it only But what does it mean to do just one thing? For methods, this typically means changing the value of only one variable If you are passing more than 2 or 3 arguments into a function or method, you are probably doing more than one thing The more arguments you pass to a function, and the longer it is, the harder it is to test and debug when something goes wrong For classes, it means having a single conceptual responsibility. When projects get big, this is how you keep them manageable.
  • 26. Does this method follow the SRP? public function set_numeric_thumbnail_size($requested_size = 'xsmall') { if (array_key_exists($requested_size, $this->thumbnail_sizes_map)) { $this->numeric_thumbnail_size = $this->thumbnail_sizes_map[$requested_size]; } elseif (is_numeric($requested_size)) { $this->numeric_thumbnail_size = $requested_size; } else { throw New Exception(__('invalid thumbnail size requested', 'shashin')); } return $this->numeric_thumbnail_size; } It accepts one argument - that’s good It changes only one value - that’s good There are no side-effects - that’s good If....elseif blocks are a red flag. There are 3 different cases being handled here. You could technically call this a violation, but each conditional block contains only one line of code, so breaking this down into more methods wouldn’t really help. But if you see the same conditions being tested over and over in different functions, that’s a sign to do some reorganizing
  • 27. #8 - Don’t over-do it: avoid needless complexity The complexity of having 44 classes in my Shashin plugin is justified by its need for flexibility You can support a new viewer or a new photo service simply by creating a new subclass. This is much more maintainable and extensible than a single huge file with deeply nested conditionals and unclear dependencies But if I knew I would never need that kind of flexibility, there would be no justification for creating these layers of abstraction – they would just be needless complexity
  • 28. #9 - Independent Architecture Why am I subjecting you to this awful image?
  • 29. “Software architectures are structures that support the use cases of the system... Frameworks are tools to be used, not architectures to be conformed to” - Bob Martin http://blog.8thlight.com/uncle-bob/2011/09/30/Screaming-Architecture.html my attachment to the community - Philly WordCamp But I’m also part of other communities WordPress is essentially a framework, so this could read “WordPress is a tool to be used, not an architecture to be conformed to” This is from a blog post called “screaming architecture” Looking at Shashin, its files and code scream “photo management and display!”, with names like PicasaSynchronizer and PhotoDisplayer. It does not scream “WordPress plugin” The fact that it is a WordPress plugin is incidental to its design. In fact I used a design called the facade pattern, which removes most of the direct dependencies on WordPress. This makes it possible to re-use outside of WordPress if I wanted to.
  • 30. Community and Architecture ✤ Why does this matter? ✤ WordPress has an architecture that’s causing its best practices to diverge from the best practices of the broader software community ✤ The WordPress community is so big that it’s easy to talk only to ourselves ✤ Developers in Ruby/Rails, Java/Spring, Python/Django, etc regularly intermingle at conferences and learn from each other ✤ I don’t see a compelling reason for WordPress to continue forever on a divergent path, and doing so means lost opportunities I wrote about this on my blog a few weeks ago I’m talking about the Singleton pattern, continuing reliance on global variables, writing integration tests but calling them unit tests (and having an architecture that precludes actual unit testing), etc. WordPress experience is not a good preparation for work outside of WordPress
  • 31. #10 - Practice, practice, practice I added this slide this morning, after seeing Eric Brace & Peter Cooper last night at the Station Inn Musicians don’t play only when they’re on stage To get good at something you need time to refine your craft, when you’re not under pressure to perform Imagine if downloading wordpress gave you blisters [my working on bus example]
  • 32. Any questions? Michael Toppa @mtoppa April 20, 2013 WordCamp Nashville www.toppa.com

Hinweis der Redaktion

  1. It’s not just other people’s code, it’s your own code, 6 months later But it doesn’t have to be this way
  2. Same technology that power disqus and google analytics My head was spinning enough already from switching between PHP, JS, and Ruby. Keeping the code clean made keeping track of all the interactions coherent.
  3. I put “plugins” in the title to draw in developers There are many aspects of coding for WordPress that are unique to WordPress, like the 2 talks before me, about custom layout and customizing the admin area, and you have many resources in the WordPress community for help with topics like that. So that’s not what I’m here to talk about either I’m here to talk about coding principles that apply across languages and across development frameworks. I want to get you thinking about approaches to coding that will help you with WordPress, and beyond WordPress as well
  4. Code formatting is important, but writing clean code is about much more than that - it’s about how your code is organized, and how clearly it expresses its intent. Good organization and expressiveness are the keys to writing code that is flexible, extensible, and maintainable over time.
  5. Stroustrup: inventor of C++ Booch: IBM chief scientist Thomas: founder of Object Technology International Feathers: author of Working Effectively with Legacy Code Jeffries: co-creator of XP development Cunnigham: inventor of Wikis
  6. Doctors take the Hippocratic oath and a set of practices to ensure they practice medicine safely Accounts are expected to do double entry booking, to avoid mistakes Other professions have standards for what it means to practice that profession safely and responsibly. When the pressure is on is when you most want them to adhere to their best practices.
  7. The software craftsmanship movement is intended to start a conversation about what it means to write code responsibly and cleanly. You don't have to agree with the ideas, but you do need to engage them. Other professions - doctors, lawyers, plumbers, etc have various degrees of government regulation. This will happen with software development if we don’t develop professional standards of our own. The $440 million stock market meltdown last summer by Knight Capital happened because they didn’t test their software properly. Everything from gas pumps to medical devices rely on software.
  8. The more we rush, the more the code turns into a big ball of mud, making it harder and harder to work with. Keeping the code clean lets us go faster, because clean code is flexible code. Why is it exactly that trying to go fast ultimately makes us slower?
  9. If you’re working quick and dirty, you’re not writing code that is readable
  10. But we’re not really aware of how we’re spending our time. Going forward, think about the hours you spend debugging, or trying to figure out messy code. When you’re trying to decide whether you should spend a little more time writing code more cleanly, remember an ounce of prevention is worth a pound of cure
  11. It’s not up to the project manager or your boss. What would your doctor say if you told her to skip washing her hands, because you’re in a hurry? What would your accountant say if you told him to save some time by no doing double-entry bookkeeping? Part of being a professional is being honest about how long it takes to do something well, and not accepting the option to do it wrong.
  12. Develop systems in small portions at a time (incremental), through repeated cycles (iterative), and take advantage of what was learned in each cycle (for both features and implementation). This workflow style complements the clean code style. Work on one thing, do it well, then move on to the next thing.
  13. This is an outline of what’s called an Agile workflow, and not all of them may apply to a typical WP project
  14. You don’t want this kind of relationship with your clients or your code
  15. This visual is a great analogy for how you should name your variables and functions
  16. Imagine a script full of variable names like this - it would be very difficult to understand. Mental translating of obscure names to their real meaning distracts from our ability to get an overall understanding of the code The days when it was important to use short variable names to save memory space are long gone Automated minification tools can shrink javascript code for you when dealing with code being transmitted over slow connections
  17. This gives us the nouns for code that “reads like well written prose”
  18. Now we get to the verbs and sentences... Take a minute to read this. Even without knowing the class or the properties, it's clear what this method does. You should use a 21st century IDE, that auto-completes names for you and makes it easy to rename. I use PHP Storm. What don’t you see in this code?
  19. The revelation for me in learning clean code techniques is that code can be expressive. That it really can “read like well written prose.” Rather than relying on comments to explain your code, the code should explain itself Comments become something you have to maintain, and if they become outdated and no longer describe the current behavior of the code, they become dangerous lies But they are sometimes necessary - for example, you may need to explain why you did something a certain way The point is to stop and think before you write a comment, and ask yourself if instead you can make the code more expressive
  20. A common occurrence in software projects is “bit rot” - the code gets messier and buggier over time. But how about code that just keeps getting cleaner over time? You can get this by following the “boy scout rule.” Keep your new code clean, and while you’re working it, spend a few minutes cleaning up the code that it works with. Improve a variable name, break up a function that’s too big, eliminate a small bit of duplication, etc. (rule 6.5 would be don’t repeat yourself...) It’s easier to keep your garden healthy and looking nice by weeding it for 10min every day than waiting until it’s a huge overgrown mess.
  21. Do one thing, do it well, do it only But what does it mean to do just one thing? For methods, this typically means changing the value of only one variable If you are passing more than 2 or 3 arguments into a function or method, you are probably doing more than one thing The more arguments you pass to a function, and the longer it is, the harder it is to test and debug when something goes wrong For classes, it means having a single conceptual responsibility. When projects get big, this is how you keep them manageable.
  22. It accepts one argument - that’s good It changes only one value - that’s good There are no side-effects - that’s good If....elseif blocks are a red flag. There are 3 different cases being handled here. You could technically call this a violation, but each conditional block contains only one line of code, so breaking this down into more methods wouldn’t really help. But if you see the same conditions being tested over and over in different functions, that’s a sign to do some reorganizing
  23. The complexity of having 44 classes in my Shashin plugin is justified by its need for flexibility You can support a new viewer or a new photo service simply by creating a new subclass. This is much more maintainable and extensible than a single huge file with deeply nested conditionals and unclear dependencies But if I knew I would never need that kind of flexibility, there would be no justification for creating these layers of abstraction – they would just be needless complexity
  24. Why am I subjecting you to this awful image?
  25. my attachment to the community - Philly WordCamp But I’m also part of other communities WordPress is essentially a framework, so this could read “WordPress is a tool to be used, not an architecture to be conformed to” This is from a blog post called “screaming architecture” Looking at Shashin, its files and code scream “photo management and display!”, with names like PicasaSynchronizer and PhotoDisplayer. It does not scream “WordPress plugin” The fact that it is a WordPress plugin is incidental to its design. In fact I used a design called the facade pattern, which removes most of the direct dependencies on WordPress. This makes it possible to re-use outside of WordPress if I wanted to.
  26. I wrote about this on my blog a few weeks ago I’m talking about the Singleton pattern, continuing reliance on global variables, writing integration tests but calling them unit tests (and having an architecture that precludes actual unit testing), etc. WordPress experience is not a good preparation for work outside of WordPress
  27. I added this slide this morning, after seeing Eric Brace & Peter Cooper last night at the Station Inn Musicians don’t play only when they’re on stage To get good at something you need time to refine your craft, when you’re not under pressure to perform Imagine if downloading wordpress gave you blisters [my working on bus example]