21 Nov 2019

feedWordPress Planet

WPTavern: Optimizing Code in a World That Doesn’t Want to Optimize

Premature optimization is the root of all evil.

It is a common saying among developers. It makes sense. Optimizing prematurely can mean redoing work down the line, and time is the developer's most finite resource. It can mean spending that precious time optimizing for scenarios that do not yet exist for a product's users. It can mean writing code that is harder to understand with unclear performance gains.

While participating with the WordPress theme review team about a year ago, I came across that nugget of advice once again. Premature optimization is the root of all evil. The reply was to a theme author who was looking to decrease the number and weight of scripts their theme needed to load. On one hand, the theme author could load a 1.29 kb script with no dependencies to get the job done. The other option was to use the jQuery-dependent script included in core WordPress for a total of 105 kb because "most" WordPress sites are loading jQuery anyway.

For me, the answer was simple. Use the smaller script unless the core script was already loaded on the front end. I did not think of it in terms of premature optimization. I thought of it as plain old, run-of-the-mill, everyday optimization.

Developers should not confuse premature optimization with the concept of making smart design decisions early in the process. Nor should they wait until the final stage of development to start optimizing, a time when the focus is on getting a product out to end-users. That is a sign of a poor product design process.

Over the past year, that conversation stuck with me. It helped me become more cognizant of a terrifying trend, not just in the WordPress developer community, but with web development in general. Far too often, developers are so far removed from normal users and the technology those users rely on that optimization is little more than an afterthought. Instead, it should always be at the forefront of any developer's mind.

The overreliance on this misused quote has helped push the trend of measuring page weight in megabytes instead of kilobytes. It is too often used as a catchall justification for not doing any optimization in the development phase while making up for it with file compression and caching in production.

Part of writing quality code is optimizing that code during every stage of the development process. It is about making hard decisions to cut unnecessary things as the software comes together. Caching should be a last resort after everything else has been cleaned up.

Premature optimization is more about attempting to optimize when there are no clear gains or working on micro-optimizations that alter the software's design for little-to-no benefit. It does not mean overlooking obvious performance boosts during development.

Not Everyone is on Gigabit Internet

Most developers I know are on super-fast internet connections, often with 1 Gbps download speeds and unlimited data. In that situation, it is easy to forget that large chunks of the world are still on slow connections with data caps.

Some may even associate slow connections with third-world countries where millions of people are on 2G cell phone technology. However, there are large swaths of the United States and other developed countries that have no direct cable or DSL lines, which are commonly available in cities and suburbs.

This disconnect is directly evident when other developers have initiated chats with me. In the past couple of years, it has been increasingly common for them to ask for a video chat. It is not even questioned whether such a thing is possible (video chats are unreliable at best for me). The ability to video chat at any time is taken for granted.

There are two internet service options in the area that I live in: satellite or dial-up. Even the local telephone company refuses to offer DSL in this area because of infrastructural costs with decades-old phone lines. Because of the prohibitive costs of satellite internet access, which typically comes with data limits, many are stuck with dial-up. Cell phone companies are changing the game to a degree, assuming service is reliable, but there are downfalls with going that route, which can include data or hotspot limitations.

For such a technologically-advanced country, many of its people are barely catching up to where others were a decade ago.

While I am fortunate enough to choose where I live and have nothing holding me back from moving, most do not have that option. They are stuck with the best they can afford. Even in rural areas, the internet is an inescapable part of daily life, and developers are not making it easy for these people.

While this is anecdotal, it is the stark reality of rural life in pockets of the US.

The upside of living in the backwoods of Alabama is that it has changed my perspective as a developer. It has meant that I needed to question every code decision for every plugin and theme I built. With data caps, I needed to make sure that I was not using too many resources.

More than anything, having a data cap changed how I used the internet. I now run an ad-blocker. I have an extension to kill videos from auto-loading. I disable JavaScript on heavy sites that I need to use. Some sites seem interesting, but I never return to them because they are resource hogs.

When you live in a place where every byte matters, you tend to avoid wasting them.

While not always successful, since my transition to small-town life, I have attempted to build applications in a way that served people who are not privileged enough to have blazing-fast internet access.

Pointing this out is about making sure developers are aware that optimization matters. It matters at every stage of the development process. It matters because these people with slow connections and data caps also need to buy products, use services, read content, and do all the other things that people do on the web.

If you are a developer who is thinking about adding that slider, swiping mechanism for mobile, or some other slick gadget, think about those of who must wait for that feature to load. Check that its dependencies are not loading too many extra resources. Do some research to see if you can locate a lighter-weight implementation. But, first, ask yourself if it is necessary.

The themes and plugins that WordPress developers build should never be the bottleneck for a website. We can do better.

21 Nov 2019 9:31pm GMT

HeroPress: Five Years Since The Dream Began

Exactly five years ago today I woke up to an email from Dave Rosen telling me my life was about to change. He didn't know yet what we'd build, but he offered me the chance to build something.

From that seed we crafted HeroPress. It was a battle, filled with uncertainty, and at times tears, but I can say without hesitation that HeroPress has changed my life, and the life of my family, for the better.

Never, ever did I expect to become friends with so many people from so many places. HeroPress has changed the way I look at the world, and the people in it. It's influenced my job opportunities. It's opened doors for me to places that I didn't know existed.

As always, I want to say thank you. Thank you to Dave for planting the seed. Thank you to all the contributors over the years, building something great. Thank you to people willing to retweet for me every week. Thank you to all the people who've trusted me with their stories.

Here's hoping for another five years!

Dave Rosen and I doing the X-Team X.

The post Five Years Since The Dream Began appeared first on HeroPress.

21 Nov 2019 3:21pm GMT

20 Nov 2019

feedWordPress Planet

WPTavern: WP Agency Summit Kicks Off December 6

WP Agency Summit, a virtual event for WordPress agencies, will kick off December 6, 2019, and last through December 16. The event will feature daily sessions by over 30 WordPress professionals that are designed to help agencies grow their business. Each session will be free to view, but there will be a price tag attached after the event closes.

Jan Koch, owner WP Mastery, is running the event. WP Agency Summit is for profit, but Koch expressed a desire to give something back to the community that has helped him over the years. "I want this event to deliver value to the WP community, because I myself have received free support countless times from Facebook groups, forums, etc.," he said. "That's why the event is free to watch online while it's running."

The event is primarily aimed at WordPress agencies, but others may find value in it. "This event is also interesting for WordPress freelancers and digital agencies who occasionally use WordPress," said Koch. "However, being a WordPress agency owner myself, I wanted to ensure that business owners like myself and those in similar situations get the most value from the event."

Video sessions will be available to view for 48 hours at no cost. For those who sign up for a free pass, they can upgrade to lifetime access for $127. That lifetime access will go up to $197 during the event and $497 afterward.

Potential buyers may want to opt for the free option before deciding whether future access to the sessions and bonus materials are worth plunking down the cash. For an agency, the cost is minimal either way. However, for a solo freelancer, the $497 price is high enough to warrant caution. Most will want to check out the material first.

Each of the video sessions is prerecorded and edited rather than shot live. Koch is using Vimeo Pro to host the videos. There will be a live hangout to begin the event. Attendees and speakers will also get a Facebook group invite for asking questions and engaging with each other.

Cloudways, Siteground, and MainWP are sponsoring the event, which helps cover some of the up-front costs. Outside of that, Koch is handling the remainder of those costs out of his pocket but is hopeful for a positive return through the sale of lifetime access to the materials.

Koch first ran a virtual summit called "The WP Summit" in 2015, which was a more broad event based on various WordPress topics. That event had over 2,000 registrations. "As you can imagine, just talking about topics related to WP resulted in a very wide-spread speaker lineup, so there weren't any clear takeaways," said Koch.

The idea for WP Agency Summit has been in Koch's mind since 2018. It wasn't until some conversations with others at WordCamp Europe (WCEU) in 2019 that it started coming together. "After WCEU, I invested in a virtual training for summits and hired a mentor to properly set up the WP Agency Summit," he said. "My goal is to run 4 events like this in 2020, so this summit is serving as 'crash test dummy' and foundation at the same time."

The Speaker Lineup

There are over 30 speakers signed on for the event. Kim Doyal, a content marketer formerly known as "The WordPress Chick," will teach agencies how to write copy that attracts higher-paying clients. Ahmad Awais, core WordPress contributor, will teach how to save time writing code in the VS Code editor.

Most sessions will focus on how agencies can grow their business with topics related to recurring revenue, marketing, and working with clients. Each day of the event will feature three or four sessions.

WP Agency Summit is hosting a diverse male lineup of over 20 speakers from Europe, Asia, Australia, Africa, and the US. However, there are only four sessions lead by women within the industry. "I recognize this as a problem with my event," said Koch. "The reason I have so much more male than female speakers is quite simple, the current speaker line-up is purely based on connections I had when I started planning for the event. It was a relatively short amount of time for me, so I wasn't able to build relationships with more female WP experts beforehand."

Koch assures that he will have a more balanced ratio for upcoming summits in 2020 and beyond. "Even in this prelaunch phase, I already got in touch with many outstanding women in the WP community which would make perfect speakers for the next events," he said.

20 Nov 2019 7:50pm GMT