My notes from Laracon 2014
###Jeffrey Way (1) - Bootcamp
Jeffrey went through about 12 subjects one right after the other and gave tips along the way.
Mail Drivers for mail notifications.
With Laravel 4.2 it’s easier to use APIs like Mailgun and Mandrill for e-mail notifications. This avoids using SMTP which is really cool.
File Generators for generating schema migrations.
Facades - Basic examples on how to use Laravel’s Facades which is basic sugar for service locations.
When using Facades it’s harder to unit test in isolation.
2. Shouldn’t be used outside your transport layer. Like http, routing, controllers.
3. You should Dependency Inject the service rather than utilizing the Facade in your domain / logic layer.
4. Doing it the DI way benefits: You remove the service locator dependency, Less reliance on framework, and easier to unit test.
5. See Facade Docs for method lookup.
Form Validation
Depending on the application, It’s okay to put Validation in the Controller. However it’s harder to change and you can have duplicate code.
A more scalable way would be to create a class that injects the Validator and then put your rules in it instead. If the Validation fails then throw an exception.
Arrays on Steroids
If you're using Laravel’s Eloquent then you have a lot of awesome methods available to you. You can also use the Collection object with any custom Array and have the added benefit on those methods. Methods like, $obj->push() and $obj->sortBy().
Magic Object Creation
Hard to explain this one, but Jeffrey talked about resolving things out of the IoC container and the PHP Reflection API. When you use the Reflection API it will “Reflect” into the class and see if it needs to inject any other methods. It recursively loops through each dependency and injects each class.
Muddy Controllers
If you want to figure out what kind of team or developer a person is, take a look at their Controllers. Depending on how much the controller is doing could very well tell that the developer doesn’t know what they’re doing.
2. If things are very sequential in your Controller method. Extract out into their own classes.
3. When talking to a business, they really talk in terms of CRUD. You could create a class that reflects what the company says. Jeffrey creates something called a “Command Bus”. Interesting.
Events
"Using commands and events as the driving force for your model allows you to capture business flows in a way that matches how people think.” Have you code reflect the intention and needs of a business.
Check out “PHP Hemoglobin” on youtube.com for more info.
Name your events in the past tense. “whenAUserHasCancelled”
Behat
Is sort of a testing framework, however it’s more of a way to write functionality the way they say it. Testing is just a nice result. It’s a cool tool that actually takes english keywords.
Resource: Jeffrey’s entire presentation is on Laracasts.com… Very good!
###Jeremy Lindbolm (2) - AWS for Artisans
Jeremy works for Amazon (AWS = Amazon Web Services) department.
Resource: Slides - https://speakerdeck.com/jeremeamia/aws-for-artisans
###Jeremy Mikola (3) - Async PHP with React
Jeremy talked about event driven non-blocking I/Os that NodeJS is primarily known for. React offers the same benefit but for PHP.
Resource: Slides - https://speakerdeck.com/jmikola/async-php-with-react
###Shawn McCool (4) - Talking Laravel.io
Shawn spoke about simple to complex application architecture. He talked about some of the distinctions between the presentation, services, and domain layers of an application. He also talked about the high-level business policy as it related to how we code.
Register Member Command -> Meat of the Application... Advantages Are:
No Business Policy in your presentation layer (controllers)
Your code shows intent
a single dedicated flow per use case
a single point of entry per use case
easy to see which use cases are implemented
Resource:
###Tim Griesser (5) - Demystifying Modern Javascript
Tim spoke as a JS developer in the midst of PHP / Laravel developers. He talked about some of the common mysteries behind JS when it comes to a server side guy.
2. BETTER: console.dir() is great when logging html entities.
3. BEST: The best thing to use is debugger; in your code. It will stop the JS process while it’s happening and allow you to look at variables in real time to see what’s available to you. This is the best
The Keyword ‘this’
this is what is left of the dot .
user.sayName() - this === user
user.friends.add() - this === user.friends
Except when it’s not
fn.sayName()
Resource:
###Ian Landsman (6 lightning talk) - Open Source & Your Business
Ian is the founder of UserScape, which is the company who employees Taylor Otwell the creator of Laravel. He talked about unique ways to fund open source products.
Funding Open Source Products
Buy the books of people who write open source
Pay for design or marketing for open source products
Use the products of the companies where open source developers work.
The other aspect of supporting open source: Code.
UserScape supports Laravel by allowing Taylor to work on Laravel exclusively one day a week on Laravel.
###Kayla Daniels (7 lightning talk) - Equality in Technology
Kayla talked about being treated differently because she is a girl. Females want to work in a place that is welcoming, inclusive, where everyone can be treated equally.
###Jeremy Mikola (8 lightning talk) - Talk on Lightning
Just some hilarious comic relief.
###Taylor Otwell (9) - Keynote
Taylor talked about some of the history and the future of Laravel. He spoke about what’s in the upcoming release of Laravel 4.2 and some of the products he has been working on like Laravel Homestead and Laravel Forge. Laravel has since become the most popular PHP project on Github.
1. Tuned for PHP & Laravel - Framework Agnostic. DigitalOcean, Linode, Amazon, & Rackspace. The stack is the same as Homestead.
2. Forge has a list of great features that looks very appealing.
1. Automated configuration of Nginx domains and sub domains
2. Quick Deploy - literally push a button to deploy
3. Easy SSL Setup
4. Forge Recipes - Save common Bash scripts and run them across your servers at any time. Results e-mailed to you.
5. Archive Servers - Disconnect and reconnect later.
6. Works with github.com and bitbucket.com service coming soon!
7. $10 / mo
Resources: https://forge.laravel.com/
###Dayle Rees (10) - Breaking The Mold
Dayle is the author of Code Bright which is probably the top book about Laravel. He has a new company called ParkAtMyHouse. He’s the head of development there.
Questions we developers have when it comes to architecture
Where do I put “X”?
How do you do “X”?
In your projects, what do you do with “X”?
Dayle rips out the Default structure in a Laravel install and starts afresh.
Base Class All Things!
App structure ends up looking more like a package.
The Package ‘Shape’
Typical Shape.
Framework as a utility.
Remaining blueprint for config.
Dayle writes events for anything significant that happens. He passes needed values for later. Puts listeners in their own folder.
###Chris Fidao (10) - Hexagonal Architecture
Chris spoke more on the lines of app architecture. Architecture helps reduce stress by keeping our applications maintainable, so making changes is easy in the short run and long run. Any bad decision you make in the start will bite you later. He talked about Technical Debt and how it relates to time on a project.
There are 5 layers.
Core Domain ->
Domain ->
Application ->
Framework ->
Outside
Every layer is an adapter for the layer inside of it. It works from the Outside In and the Inside Out.
Outside Layer = Comes from Web, API, CLI, Queue, or Event Handler
Framework Layer = All the code that helps you do stuff but isn’t your application.
Application Layer = Orchestrates the domain layer. Implements the domain logic.
Domain Layer = The logic behind the application. There should be boundaries between the two. It defines the interface for the application layer to talk to.
Identify the aspects that vary and separate them from what stays the same.
Key Point: Encapsulate Change.
Resources:
Slides - https://speakerdeck.com/fideloper/hexagonal-architecture
Books - http://www.amazon.com/Head-First-Design-Patterns-Freeman/dp/0596007124
###Greg Bauges (11) - Devs & Depression
A very serious talk about mental illness. Greg is BiPolar and ADD.
Resources:
###Igor Wiedler (12) - Abstract Machines
You just had to be there. Mind Blown. Can’t explain.
###Cal Evans (13) - Going Pro
Cal spoke about principles that make a “Professional Programmer”. He’s sort of a motivational / inspirational speaker that has been around the block a few times.
Being a professional programmer is not a skill net, it’s a mindset.
Getting paid is not what makes you a professional programmer.
D.U.C.C.H.T
Duct Tape Master - Any person who can take two components and stick them together to make something happen
2. **U**nderstanding - Understand the technologies that you are using, the stack that you’re going to deploy, and the technologies that your client is going to want you to deploy. Your client is an expert at the problem, not at the solution. You’re the expert. You have to understand what the proper solution is and why.
3. **C**urious - Get involved and be curious about technologies you use. You don’t have to master every tool but you should know what they are and when they’re appropriate… Start a project just to experiment. Only goal is to learn one thing.
4. **C**ommunicate - Learn what language your client communicates in. Not everybody speaks programmer.
5. **H**onesty - Be honest about how long their project will take. Be precise. Break your tasks down and fully understand what is involved and how long it takes you… Be honest with your skill set… Explain clock time VS. Calendar time. 40 hours doesn’t mean 1 week, it could be a month.
6. **T**eam Player - If you’ve never been a developer, you have no business managing developers… Cal says he rather have 4 mid level developers on his team than 1 amazing lone wolf… If you call developers “resources” then I will call you “overhead”.
7. Being a pro doesn’t have to do with your mad skills, but with solving problems.