Developer Book Club

Posted on 27 Jan 2017

I love to read, its one of my favorite hobbies. However, I sometimes feel that I just read and never really take things in. So late last year I decided that I was going to buy second-hand physical books all about software engineering. Some I have kept as kindle books either for price or just because it was more convenient to get the kindle version. Yet, on the whole, I got some real bargains and I made sure that I got a good selection of books going back to “the classics”.

So back to the problem of just reading and never absorbing the knowledge, Well I decided that each month or weeks I am going to hold an online Book...

All hail Xdebug and lets let var dump die

Posted on 30 Dec 2016

How many times have you been working in Magento or any other php application and hit an error, exception or something not quite right? For me a lot. I’ve been that developer that debugs by fire and throws echo var_dumps and dies around like a western gunslinger. It’s easy, provides quick feedback cycles but lets be honest its lazy, in efficient, rarely provides all of the data you need to solve the problem on the first try and its not something you want to boast about by the coffee machine.

Before we look at the future lets take a trip into the past and well present for some people. What can go wrong and what are we missing by adding...

A new look and a cleanup of content plus good bye github pages.

Posted on 20 Dec 2016

I had big plans for 2016, It was going to be the year of blogging. Reality hit hard a few months back when I realised that my todo list still had some many blog posts pending work. As many of you know I made the hard descision to leave Inviqa where I had become Technical Team Lead and spent many years working on cutting edge Magento 1 and Magento 2 installs to persue a role as Architect at Magento. On top of this I also hit a record number of speaking engagments traveling all around the UK to Mexico, Las Vegas NYC and many more.

Fear not the blog is back. Instead of just throwing new content on...

Docker and Docker Sync

Posted on 17 Dec 2016

I have been a docker-machine user for some time now, and to be honest I loved it. Performance was as good as with Vagrant, I didn’t have many issues except the biggie that was my containers running out of space. Within the docker-machine VM they only have a finite amount of resource available so it required a manual touch to make them bigger.

Ever since the beta came out for Docker for Mac and Windows I have been dying to use it as my docker tool yet the performance issues just made it un workable.

Yet with the introduction of the new Magento 2 developer box I thought I would have a play with it. The new dev box images...

Patching Magento 2 vendor directory

Posted on 17 Dec 2016

During the last Magento meet up in Manchester hosted by Push On I was asked about and we all had a conversation about how people are handling patching of files installed via composer.

Lets re wind a little, why would we want to patch a file that lives in vendor directory? Well in Magento 2 there are some bugs, Often there is a pull request waiting in github ready to fix this problem but forking and maintaining another repo is not ideal when it comes to the underlying framework.

One of the ideas presented that works is to commit the entire vendor directory and make the changes to the file and commit to the repo. Lets analyze...

Getting started with Magento 2

Posted on 13 Feb 2016

It really has been a fun few months recently for me. 2015 saw me start working on Magento 2 and only recently have I had time to reflect on what Magento 2 really means to me. First up is a video interview I did for Session Digital on my involvment with Magento 2 and my initial thoughts:

Then I gave a talk on getting started with Magento 2 for a developer. The talk went down really well and I got lots of great feedback.

Magento 2 is a massive step forward in terms of technology for E-Commerce and the 2 projects I have deployed to production have been...

Describe the core domain of Magento using BDD tools

Posted on 08 Feb 2016

Previsoulsy I covered how to use PHPSpec to describe behaviour at a low level or Unit test level. Today lets take a look at what it takes to use Behat and actually describe user behaviour through the site.

Before we start I recomend reading Modelling By Example by Everzet. Its a really great article about BDD and DDD.

So the first thing we need to do is install Behat in our project. Yet again open up the main composer.json manifest file and this time in the require-dev section add in "behat/behat": "3.*", Save the file and run composer install. Assuming all went well we should be able to run ./bin/behat and get an error...

Load modules and themes from src in Magento 2

Posted on 07 Feb 2016

One of the biggest changes for me in Magento 2 is the fact that we no longer have code pools app/code/local etc. This represents a massive shift forward and a great design decision by the Magento 2 core team to adopt the composer autoloader.

Now for shared modules the logic is easy, You create you composer.json manifest file and in the mappings specify via PSR-4 where you want the namespace to resolve to. Then when someone wants to use the module they updated the main projects composer.json manifest and the rest is magic.

But what about the Companies or Solution integrators that use a mixture of both community modules and also develop single use modules. How can a project setup...

Getting started with Magento 2 module development

Posted on 06 Feb 2016

I’ve been using Magento 2 for a few months now. I was lucky to be involved in the merchant_beta program and at the developer meetings in Berlin early last year. Yet lots has changed in the way we develop modules since I started working on the framework almost a year ago. One of the big changes is that now modules can be loaded from any location and require more configuration to setup.

Lets start by creating a new folder within app/code called Jcowie. Think of this as our top namespace.

Now within Jcowie create a new folder for HelloWorldModule This is going to be our actual working Module code. Now I’m still playing with ideas here as there is no...

How to use PHPSpec and Magento 2 a quick start

Posted on 06 Feb 2016

Using PHPSpec in Magento 1 was never an easy task. There was no Dependency Injection so it made it hard to actually inject dependencies into our classes. This in turn had the knock on effect of forcing us to actually test the classes our subjects were being used in. Whats the big deal I hear you say? Well. Why should we have to bootstrap the entire framework just to unit test a piece of behavior we are developing? Most of the time ( and if we are designing ) our code well we should be de coupled from the framework so there is a clear divide between business logic and framwework code. more on this in future posts