Top Laracon Conference Presentations

Laracon is an ongoing series of conferences and events about the Laravel software development framework. We use Laravel pretty heavily at Icehouse Ventures because it powers our Investor Portal. I’ve learned a lot over the years from the various Laracon conference recordings. The topics range from basic coding best-practises to advanced systems architecture, database design, all the way through to user interface design. The talks I get the most out of switch between broad theoretical best practises but then back it up with practical live coding examples. I’ve made a list with a few of my favs and some notes on how they influenced view of what’s possible with Laravel…

SOLID Design Principles

This talk with Katerina Trajcevska covers the basics of the SOLID coding principles. SOLID is short for:

  1. Single responsibility principle,
  2. Open-closed principle,
  3. Liskov substitution principle,
  4. Interface segregation principle, and
  5. Dependency inversion principle.

The SOLID jargon can seem heavy at first, but it actually fits nicely into good Laravel coding practises and Katerina lays things out simply and clearly.

Curing the Common Loop

This talk probably changed my approach to coding more than any other talk. The idea of using chained functions, scopes and collections aren’t that revolutionary by themselves, but seeing Adam collapse whole pages of complex nested code into a single line is just magical. The elegance, power and simplicity of Laravel collections when they’re used properly blew my mind.

CRUDDY by design

Another mind-bending talk from Adam Wathan. CRUD is short for:

  1. Create
  2. Read
  3. Update
  4. Delete

I do not necessarily agree with everything this talk, but the mental exercise of trying to see everything in a modern web application as a CRUD operation is a matrix shifting moment of clarity. We now heavily use Laravel’s built in “Resource Pattern” to link models, views and controllers into common CRUD functions.

Eloquent Performance Patterns

Eloquent is the data modelling ORM (Object Relational Mapping) tool built into Laravel. It’s an amazing tool, but Jonathan comes from a ‘bare metal’ background and like me, learned MySQL years before he learned to code in a modern framework. As such, he thinks in raw database queries. Laravel’s ‘Query Builder’ is the database layer that gets things from the database before passing them to Eloquent (to wrap the richness around). This talk is all about speeding up Eloquent by doing more in the database.

Laravel Performance Optimisation

Kasia Zien takes a pretty detailed and hard-core approach to performance optimisation, but it’s eye opening to see her logic for how to squeeze the best performance out of Laravel.

Software Design Patterns in Laravel

“Design Patterns” are best-practises or standard approaches to common problems in programming. Not every design pattern is a good habit (the repository pattern can over-complicate a project fast). But when used carefully, the various software design patterns make for better and more consistent code. We use the Presenter Pattern at Icehouse Ventures to tidy up data before sending it to our Vue JS front-end.

The Laravel Way

Jeffrey Way is one of the original gangsters in the Laravel community. As an OG, he’s been working with Laravel so long that he’s drawn out the broader mindset of what I think of as the “Laravel Way”.

Chasing Perfect Code

Yet another Adam Wathan talk, but honestly every one is a level-up in terms of how I write code. Adam goes through ‘code smells’ and things to tidy up. Things like nested-conditionals may technically work in a solo project or a university code exam, but in the real world our code needs to be read by other developers or by your future self. This presentation taught me to make my future self’s life easier with code that is simple, readable and clear.

Diving Deeper

One of the things I love most about Laracon is being exposed to more advanced topics in software engineering that I might not have otherwise discovered. For example:

  1. Database Indexing – The art of indexing a database is kind of obscure, but the pursuit of fast queries and ‘groking’ database indexing stretched my mind and reminded me how much I love MySQL.
  2. Denormalisation with Eloquent – The Icehouse Ventures investor portal calculates pretty advanced ‘professional investor grade’ maths and charts like IRR, TV/PI and other venture capital finance metrics. Many of those are too complex to run on the fly so we tried caching them. But with thousands of investors and hundreds of metrics our cache became a mess. Database normalisation saved us but also forced me to learn about cache warming and cache invalidation. This is the Laracon talk I wish I has watched before we built our Entity Stats table by hand.
  3. Resisting Complexity – When I dive into the Laravel core code (the stuff we’re not really supposed to see and can’t edit) I’m always surprised by how small each function is. Each function does one thing, then passes it onto the next atomic unit. At first it seems wasteful, but Adam walks us through how breaking big functions into small ones makes them cleaner, clearer, more re-usable and more testable.
  4. Clean Code – Uncle Bob invented the SOLID principals and is a legend in software development. Not Laravel specific, but a great reminder of the wider context of why clean code matters.
  5. Design Patterns that pay off – Matt Stauffer lays out some advanced design patterns and boils them down into simple good habits for good code.

I’ve saved all these Laracon presentations as a YouTube playlist so it’s easy to find them, play them and refer back to them in the future: Laracon YouTube Playlist

Using JavaScript with Laravel through Inertia and Livewire

For the upcoming Icehouse Ventures investor portal we chose to build the application using Laravel, which is a php framework. Frameworks like Laravel speed up the development process by providing a lot of the scaffolding that you need for a modern web app.

Mockup of the upcoming Icehouse Ventures Investor Portal.

We started off looking at using off-the-shelf tools such as venture capital fund management software and various online angel network platforms. But we couldn’t find any tools that would allow us to provide combined reports that showed a consolidated view of both direct angel investments into a company and indirect fund investments into the same company through a fund the investor was a part of. Investors told us that this was a mission-critical feature so they could evaluate their effective exposure to particular startup companies in their portfolio.

We also evaluated a range of other low-code and no-code solutions such as Salesforce and various template-based databases and website builders. These were ok, but couldn’t handle the depth of complexity investors wanted such as calculating IRR over long time periods, exporting PDF statements and ranking portfolio performance against other investors.

Laravel uses the classic Model-View-Controller architecture.

In the end, we chose php and in particular Laravel because of the robust stability of a MySQL database and the power of the Model-View-Controller approach to the code structure. MVC is a common pattern used in enterprise architecture to build scalable and stable software systems, the key elements are:

  • Model – A data model that manages your database and represents data as objects that can have relationships with other objects. For example, we have a model for Users and a model for Companies in the investor portal.
  • Controller – Traffic controllers that manage how data moves around your application. Controllers fetch data from the Models and send it to the Views. In Laravel, the controllers do a lot of heavy lifting in the background such as security, permissions, sorting and filtering.
  • View – Templates that render html and CSS for the end-user to see what you want to show them. Laravel uses a php and html template format with no JavaScript interactivity by default.

Adding JavaScript to Laravel

As much as I love php, we wanted to provide investors with a modern app-like experience. To do this we needed a modern JavaScript framework such as React (from Facebook), Angular (from Google) or Vue (an open-source JS framework). I chose Vue because it’s popular in the Laravel community, not owned by a giant tech company and is the fastest to learn for a non JS developer like me.

There are several approaches to getting front-end JavaScript frameworks to work with back-end applications like Laravel:

ApproachAdvantagesDisadvantages
Single Page Application with API – The traditional approach has been to build the JS front-end as a single page application and feed the data through to the app using a private API.By keeping things separate, it’s easy to focus on one thing at a time. Back-end developers can work on the back-end code and front-end developers can focus on the front-end code.My experience with SPAs was that I wasted a lot of time keeping the API and the front-end talking to each other. Frustrating points included login tokens and data-table filtering. In a small in-house tech team there’s no such thing as separate back-end and front-end teams, we’re all full-stack by necessity.
Livewire – This approach allows you to use little bits of JavaScript inside your normal php templates.It’s cool to have php everywhere and JavaScript only where you most need it. Like a modern framework approach to JQuery.The disadvantage of Livewire is that it’s still mainly using php not JavaScript, so it doesn’t have the app-like feel of an SPA. It’s also not full-on best-practice JavaScript using Vue or React so you miss out on the Vue and React templates and resources.
Inertia – This is a new way to use JavaScript inside the MVC framework of a php app. The Model and Controller are in php and the View is in JavaScript.Best of both worlds. Inertia lets php do what it does best (databases, models, relationships, security, etc) and JavaScript can do what it does best (render the front-end interface and provide interactivity).Not technically an SPA. Requires some finesse to make it feel fully app-like and the progress loader is a bit clunky. Inertia puts JS right inside your php monolith so you now have a multi-language code base that might feel weird to some developers.
Livewire is a new method for using JavaScript inside a php template.

Laravel 8 was released recently and now includes both Livewire and Inertia as options for the default Laravel user interface templates (called Jetstream). This is exciting because it will expose these two new approaches to more developers. But it’s been confusing for a few developers who are used to thinking of JavaScript as a different world from php.

Inertia allowed us to use Vue JS in our Laravel app.

On balance, we opted to use Inertia for the Investor Portal because it kept our code base all in one place and allowed us to move fast and change things quickly based on user feedback. I’ve already had dozens of moments where we wanted to make a change to the way that something is displayed in the portal. It’s a true joy to be able to make a quick change to the Company model, flow it through the Direct Investments controller and have it pop up in the investor portal Vue file all in the same code-base, with easy Laravel debugging and easy feature-testing and front-end testing. By having Vue running inside Laravel I’ve upskilled quickly on JavaScript without having to go all-in on complex JS routing and data manipulation.

Notice the simple call to Inertia from the Controller. Just like a Blade template.

We also went for Tailwind CSS instead of the more established Bootstrap CSS framework. Tailwind is a utility framework approach which means that instead of single giant templates in CSS with little HTML tags you just layer lots of little HTML tags onto an element to make it look the way that you want. It seems messy at first but once you get used to it, it’s life changingly fast. Using Tailwind, Alipne JS, Livewire and Laravel is called the TALL stack and I’m calling Vue, Inertia, Tailwind and Laravel the VITL stack. (Some people prefer the name LIT for this stack but I think Vue is a vital part of what makes this approach so awesome).

Building software in-house is an unusual move for a Venture Capital fund but Icehouse Ventures has a unique approach that combines the scale of the Ice Angels network and the depth of major funds like IVX and Tuhua. Globally, the venture capital industry is being quickly re-shaped by increased investor demands for transparency & reporting and by startup founder demands for faster decision making & streamlined capital raising processes. Technology can be a force multiplier for us and having both php and a modern JavaScript framework like Vue in our toolkit means that we can move faster while still keeping things safe, stable and secure.