Building Laracon Online

This will be the third year we’ve been running Laracon Online and I have learned a lot about selling tickets in the process. Based on this tweet I was reminded of how we’ve reworked the order system over these three years and I wanted to share with you the progression.

The first year we used a third party service to sell tickets. For the percentage they would take we assumed it would be a decent deal for us since we wouldn’t have to build out any of the infrastructure. However, I was swamped with support that year. I had hundreds of people entering their email addresses wrong and other weird stuff. It was a nightmare.

From this point we decided we would build our own system for the next year and I tried my best to build the simplest system possible. You hit the /pay route, added all the emails you wanted to buy tickets for, entered your account info, and pay. Behind the scenes we would email all the people and tell them to reset their password to create an account. It was simple and worked great.

Now that we had all this data for this year I was brainstorming on how I could make it even easier for people to purchase and I came up with the idea of just pre-filling the checkout system with all the people you purchased tickets for last year. So if you work at a company buying tickets for 20 people all you have to do is confirm they all are the same and hit buy.

Thinking through all this took some time but the implementation was really straightforward and only took me a night of hacking.

As developers we want to focus on the code and think about how to design apps that are easy for us, but our focus should always be on the end user. Even if it adds complexity or makes our app harder to manage later. The customer is the priority and making their life easy is why we are here.

Everything is always a trade off, just make sure you are prioritizing what is important.

Set your Terminal to Red for Production

Making mistakes in production is one thing that always scares me. This problem multiplies if you use a lot of terminal tabs but a quick and easy solution is to make production red so it’s immediately noticeable where you are logged into.

For the image above I’m using Termius on iOS which supports this and allows you to set it on a folder level and then any ssh connections under the group inherits the color.

It’s a really simple way to help distinguish which connection you are logged into and can be a life saver. This can done in other terminals too, just do a web search to find instructions for your app of choice.

Refactoring For Prose

I’ve worked with a lot of legacy applications and one thing that I have seen many times is small things that are confusing. For example, I recently came across some code that looked like this:

if ($foo) {


    $noAction = true;


} else {


    $noAction = false;


}

That is pretty straightforward and easy to grasp. But what comes next is where the problem lies:

if (! $noAction) {


    //...


}

If we read this as a sentence it says, “if not no action” and most of us struggle figuring out what the double negative translates too. It’s not something that we encounter very often in English so when we see it our brains turn to mush.

From my experience things like this are common in older procedural code because you are defining the variable so far away from the use that it either morphed into the current style over time, or the variable is used in several different contexts and this was the path of least resistance when it was originally coded.

While you are coding try to think through things like you are writing prose. In this example, maybe something as simple as renaming the variable to $doAction would be sufficient.

if ($foo) {


    $doAction = false;


} else {


    $doAction = true;


}




if($doAction) {


    //... 


}

In my opinion reading “if do action” is much clearer and easy to grasp.

Sleep on it

The old saying, “sleep on it”, meaning spend some time tonight thinking about the question and have an answer tomorrow.  It’s a common phrase in our language but how often do you literally put aside time to actually think about it?

Having a busy life outside of work with family, hobbies, dinner, everything else it’s really hard to set aside time to just sit and think. I’ve had to start using the time just before bed, mornings, or go for a walk alone.

Yesterday I was working on a new integration an app we recently launched and I had to work on adding a new API endpoint. It was all really straightforward.  However, last night as I was reviewing my day before bed I started thinking about the way I solved the problem and realized I may have made a mistake because I forgot about a constraint from the service that’s going to be reading it.  While trying to solve that in my head I realized I solved the entire problem wrong and I should redo my work.

What I do each night is review my day like I was a star in a TV show and I’m following myself around as the cameraman with the goal of looking at my decisions from a different standpoint. This is what helps me attempt to remove my biases, but of course, that doesn’t always work. It is pretty good at allowing me to see mistakes though, and that’s why I do it.

I know many programmers spend their after work hours coding and being on the computer but I implore you to take a break. Get away from the screen and you’ll actually do better work.

 

Striving for Simplicity

I recently launched Laravel Events and it was one of those projects that came to life because I wanted to better keep the community informed on what all local events were happening.

As I sat down and started planning the project I wanted to start with the goal of doing the absolute minimum to make it work. This is just a small side project, no money involved, just a directory, so it doesn’t have to be complicated.

At the core that would be a form to submit the event information, a way for me to edit/approve/delete it. That way it would account for spam, invalid listings, etc.

To do this I had to make a tradeoff, and that was once you submitted a listing you can’t edit it. In fact, I don’t know even know who submits. I’m storing zero data on you, and only the public event information.

I’m sure you are thinking, “but what about when they need to change something related to an event?”, and that has come up but since launch, it has only happened twice. It also only took me about 20 seconds to make the change for them so, in my opinion, it’s been a good tradeoff. Once it starts being a greater burden then I will rethink that part and editing.

When I see developers starting new side projects they almost always overcomplicate it. Keep things simple, until they are a problem, and then revisit. It saves a lot of time and headache in the beginning.

Process Cards with Stripe + Twilio

Stripe just announced support for Twilio Pay:

Phone payments are especially common in industries like food, travel, healthcare, retail, and nonprofits, but payment details are often keyed in manually by a human agent. This flow can be riddled with errors and expose companies to security and compliance risks. That’s why we’re partnering with Twilio to help companies integrate phone payments quickly while ensuring the checkout flow remains secure and PCI compliant.

With Twilio <Pay>, businesses can now securely collect payment details with an interactive voice response flow, which is useful for automating payment experiences such as bill collection or donations. For a more personalized experience, employees can also walk customers through an order over the phone: when it’s time to collect the payment, the agent activates Twilio <Pay> to let the customer enter payment info using their keypad—agents can follow the customer’s progress, but won’t see or hear the card details.

This will be huge for anyone that handles phone sales or customers that struggle with online forms. It reminded of an interaction I recently had with a live chat agent where I wanted to switch a subscription to a new plan. For whatever reason, they said that they would need to cancel my current order and then have me resubscribe and re-enter my payment info. They were able to push a new popup to me that included all the forms and outside the agent’s eyes. I thought it was clever.

What Makes PHP Popular?

I saw this question pop up on a forum and I know every PHP developer has their own reasons, it made me think of why I initially picked PHP way back in the early 2000’s when v4.3 was king.

It all started when my family hired a web developer to create a website for their motorcycle dealership. Everyone was moving to the web, and we didn’t want to be left behind. We ended up hiring a local guy, and a few months later a new website was delivered that was built entirely with Microsoft Front-page. He sat with me for an hour or so and showed me the basics on how to update it, took his check, and then went on his merry way.

Flash forward about two months, and I was spending half my day on Front-page forums trying to figure out the tool and how to make cool things. I loved it! Eventually, though I was sick and tired of Front-page, the extensions kept breaking, and every time it was a nightmare to fix.

This led me to a crossroads. I wanted to remake the site so it was dynamic and so we could quickly add new inventory. The two languages I heard was best for this was either ASP or PHP. To a newbie, they both seemed like greek, but PHP hosting was cheaper, so that is the direction I went.

With the language chosen, I started reading everything I could and tinkering, but it didn’t “click” I struggled more than I’d like admin with understanding the relationship between PHP, MySQL, and Apache. Keep in mind back then I had zero tech friends and nobody local I could even ask. It was trial and error from tutorials and forums.

What I ended up realizing is the part I struggled with was that I couldn’t actually see the relationship between all these tools. Around this time I tried Dreamweaver, and it helped tremendously because it was all basically integrated into a single app.

As I compare then to today the training material now is leaps and bounds better than we what we had. Yes, web development is way more complicated today, but everything from tutorials, to training videos, to even open source apps. Everything is better explained than back then.

So to finally answer the question, “What makes PHP popular?”, For me, it was cheaper hosting, and once I grasped the basics, I never left the community. If it works, embrace it.