Archive for September, 2015

Building against Magento 2 – My Thoughts So far

Posted by: Karen Sunday, September 13th, 2015

Over the past couple of months in between my day job of running WebShopApps/ShipperHQ (which keeps me more than busy) I’ve been writing Magento 2 extensions. For fun? No not exactly, we were asked to write them by Magento for the Merchant Beta, the rest of my team is maxed so I get the short straw.

I wanted to jot down some of my experiences so far, and my conclusions at this point in time. I realise you will not all agree, in fact far from it. But someone needs to raise these issues. Because many of them are valid I’m sure.

Magento 2 is a total rewrite of all our code

What I’ve found is that pretty much without exception we need to rewrite all our extension code.  In the most part I have no issue with this. Its a chance to refresh, do things differently, regroup. But where I do have an issue is where I have code written in the last year and I’m finding that very little can be re-used due to the changes in Magento 2. And worse, if I do take the code and copy into Magento 2 extension I then have hours of painstakingly boring and meticulous work pulling out all the objects into the constructors, creating the factories, adding namespaces, switching around the way many many mechanisms work.  The IDE is not helpful, coming from using IntelliJ on Java in the past 2 years I find PHPStorm is just utterly frustrating on every level. And its written by the same company, so clearly many of the isues are actually with the PHP language. Hopefully Magicento can help us!

Magento 2 is changing

It’s clear from looking at the Magento 2 codebase that not all of it has been fully refactored.  In between Merchant Beta and a release just 3 weeks later my Magento 2 extn broke because of changes to the core code.  The code is inconsistent, e.g. the use and non-use of underscores for variable names is frankly totally frustrating, as if you try to adhere to not using underscores (as seems to be recommended) you then find you are either repeating variable definitions in parent classes or have this rather odd mix of underscore and non-underscore in your own code (which looks awful). I get its in beta.  We are being asked for code for ‘free’ against beta. Its frustrating.

There are many other examples around this area, for instance there was a full-on debate the other day raised by myself on whether Observers still are valid or are replaced by Plugins. TBH I felt like I was a leper even questioning the concept, and I was shouted down initially with a very firm argument against me saying that Observers were dead (which in my mind went against core computing principles around the use of interceptors). In fact they aren’t, as became apparent later. What if I hadn’t have questioned this (and if Alan Storm didn’t raise many of the very valid questions around Magento 2)?. In my mind these basic principles of the Magento framework should be fully decided, documented, and ideally adhered to throughout the codebase so we have examples (especially when there is a lack of clear documentation).

The biggest point here is that I don’t believe Magento really appreciate the knock-on effect of constant fiddling with the Magento 2 code. Agile is good, quicksand is not. They are asking us to write extensions on Magento 2. This is not a quick job, its tens of thousands of dollars worth of investment. And then if Magento go change everything we need to rewrite. This is why I personally stopped coding in Magento 2 between Feb and July, it just seemed that it was changing far too much to justify my investment of time.

Documentation is Sparse

There is an extreme lack of documentation to help us.  The DevDocs area is non-searchable (yep I know the reasons why) and from my perspective its not adding value. Alan Kent and Alan Storm blogs are what I’m looking at most, apart from that I’m reading core code (hello 2008).  I just hoped we would be further along by now, I don’t want to be investing my time in debugging the core or searching google, I just want to get a job done and fast.

Yes, I hear you say, write some docs for it. I have updated some docs. I’d do more but I have my own docs to deal with. I’d love to have hours to spend on writing Magento 2 docs but I have my own business to run. Magento is not my life, its a platform I integrate onto.

Design Pattern Overdose

It feels like some programmers swallowed some books on design patterns when I look at Magento 2.  I get that architecture on such a large system needs to move towards standards and in an ideal world I’m sure we would all love to be using SOLID principles and never write an else statement, it seems to me that the resulting code is:

  1. Bulky, difficult to navigate and frankly overly verbose
  2. Written with unit testing as its primary goal
  3. Inconsistent in its use of computer science techniques

What Magento does is great, and I have the utmost respect for the Ukrainian development team that largely put this together.

I think whats bothering me is that as a company I’m being forced to write in this new way too. And actually whilst I think they have some great ideas I don’t agree with all of them (e.g. lets dependency inject the world even if we will never ever ever mock/change that), and they just added a ton of dev time to my projects.

I should say that I’m familiar with design patterns, have used them recently and in the past. I’ve read GoF many times, and variations of it. Do I live my life by it – no. I’m not trying to be the best programmer in the world, I’m not interested in winning the award for anything. I’m trying to deliver quality timely solutions to my customers within a reasonable budget such that I can pay staff wages and my mortgage. I have nothing to prove academically.

TDD

We all want to do test driven development (in theory). In reality few do. I’ve done pair programming, I’ve done TDD, in various languages, and its very hard to make that the way you function.  There are many articles on TDD. Personally I think that unit tests are extremely useful, especially when it comes to refactoring and regression testing code, and I push all my staff to create.

But writing tests when you don’t understand the framework you are using is nigh on impossible, so following TDD when you start writing Magento 2 code IMO is very hard.

TDD is also time consuming. And unfortunately we don’t all have massive budgets or unlimited resources.  Its  a massive re-pivot to ask a company to follow a TDD approach, especially initially.  I have no doubt it will happen, and it will be a good thing, but I’m just not sure automated unit tests will be there from day 1, and by enforcing it you are saying that companies need to have more funds (i.e. its becoming an enterprise product).

As a FYI we use automated unit testing very successfully in ShipperHQ, we also have automated unit tests on several of our Magento 1.x extensions. I’m not against unit testing at all (and I believe in the long run it will improve the quality of extension codebase massively).

Do we need Magento 2?

This is the biggest thing I’ve been struggling with. I know we need Magento 2 in theory, I totally get that we need higher quality, more testable code, and we need to bring the technologies upto date.

But – you know what we are all busy. And I have a team that is trained in Magento 1.  Yes there are issues in 1, do I want to throw away a years worth of work at this time – frankly no.  And it’s not just a years worth of work, because what I’ve found is that you end up just refreshing everything.

Add to this the fact that everyone is busy. We are all earning money right now and need to keep up with that. Do we have the time to invest in Magento 2?  It is not 2008, there are many alternatives (including 1.x), maybe as businesses we decide not to invest in it.

Personally I do think we need Magento 2, well we need a replacement. I’m just not looking forward to the pain of what it is!

Integrating as a Technology Partner

From my experience thus far in Magento 1.x and 2.x our base investment in Magento is at least 100 times what we are investing to plugin into other eCommerce platforms. The ongoing investment for supporting an existing extn is massively more (though hopefully some of this will be alleviated with the introduction of service contracts and clear interfaces when they are completed).

Personally I think technology partners just want to worry about their own area of expertise, whether thats email, ERP, shipping, payment, or whatever. And they just want to plug in to Magento as easily and quickly as possible. With other platforms we don’t have our codebase under anywhere near the level of scrutiny as we are having to go thro with Magento. And it actually just works, nowhere near the level of site issues (in fact there are no site integration issues due to the way platforms such as Bigcommerce/Shopify define their apis).

Conclusion

I love Magento, and all its about. The merchants, the code, the community, the ecosystem.  Magento 2 promises us many things, reduced conflicts between extensions, better performance, higher quality, to name but a few.

But I feel like no-one is flagging these very real concerns, and they should be flagged. Because it will affect us all directly or indirectly. If this blog makes one of the Magento developers sit down and write more developer documentation or helps push Magento publish a functional roadmap outside of github then my job here will be done.

If Magento 2 is hard to learn and does result in longer more expensive projects then I’m not actually sure companies will move to it. I think agencies might try one project, find out that it costs them a fortune and revert back to 1.x.   I think extension companies will write basic extensions, see what the uptake is before investing significant money in building out more.

What I see is that Magento 2 today is destined to be an Enterprise solution. For definite anyone with a Magento site < 1million in revenue (and a decent profit) should really be looking at other solutions for their needs. You are going to see design agencies disappear, extn agencies disappear. And you will see new ones enter. But I’d be very surprised if the agency prices on Magento 2 implementations don’t rise dramatically. A big reason within this is that Magento developer salaries will rise further, because many will struggle with it.

What I’d like is for Magento to tell us where Magento 2 is pitched. And be clear about that. So that thousands of agencies/developers/merchants dont invest in this and then find that all their hard earned cash is sucked up in a money pit with no return.

And actually I’d love to be proved wrong on all of the above. Because personally the thought of this community become a small cliche of elite programmers and gold solution agencies just doesn’t appeal.

Under The Hood of Andy Crathorne

Posted by: Ashley Tuesday, September 8th, 2015

Andy CrathorneAndy Crathorne (@andycrathorne) is Magento Project Manager at Media Lounge (@Media_Lounge), a Magento eCommerce website design, development and optimisation agency. Media Lounge is dedicated to helping their clients stand out by providing a total online solution, which has led them to be an award winning agency.

Within our interview with Andy, we were able to get a better understanding of what a Magento Project Manager at Media Lounge does. We also got a sense of what Andy’s personal life is like. He shares how he spends his free time engaging in activities that help him to stay healthy mentally and physically, along with many other details on his life in and out of work.

Can you describe what you really do at work?

My main role at Media Lounge is managing Magento projects from inception to launch, working with in-house design and development teams as well as third-party developers, such as WebShopApps. This covers scoping technical and functional requirements, wire framing, managing the design process, putting together technical instructions for the development teams, testing, amends, and of course client training and support at the end.

If money was no object, what would you spend your days doing?

Working with designers and developers, I would spend my day oozing out every last bit of conversion, trying different things (no matter how small) to see if I can get the most out of the traffic you already get. That, and plenty of exercise with a healthy mix of food and drink!

I’m a firm believer that a healthy body = healthy mind. I have a very healthy diet and make sure what goes in my body is natural and organic as best as possible. This certainly helps to keep me going and focused.

In your spare time what do you get up to, and how do you balance this with your workload?

I run an eCommerce store myself in my spare time (also on Magento) so apart from working in the ‘eCommercesphere’ I try to keep as fit and healthy as possible. Playing squash, football, cycling and running are my favourites and I snowboard each year.

How do you see the future evolving for Magento and the eCommerce space in general?

I’m looking forward to Magento 2 to see how that changes things. Mobile is clearly taking over but I’ve yet to see a real boost in mobile conversion. In my experience people are browsing and researching on their mobiles but actually purchasing on their tablet or desktop. I’m looking forward to seeing a really slick mobile payment method built into devices become mainstream.

The subscription model is exciting but I think it needs work to become the norm. To be really successful I think we need to address the delivery side of the process. If you’re not in at the time of delivery and you have to collect it from the depot or arrange a re-delivery you may as well just pop to the shops yourself.

What is usually your last thought before falling asleep?

As soon as I hit the pillow I’m gone so it’s hard to say! My last thoughts usually revolve around what I’m up to in the morning and the next day.

Who is your role model, and why?

There are a few people I follow and look up to for their achievements and ideas. To name a few, Michael Dubin, Elon Musk, and Timothy Ferriss.

What motivates you?

Working with clients that have the drive and skills to really take their business forward, with support from me along the way. These are the clients that I learn from the most and are usually the most fun to work with.

What is the most played song on your MP3 player or phone?

We’ve started listening to classical music in the office after a convincing study on the effect on concentration when listening to classical music. So far it seems to work!

Would you like to plug anything?

Media Lounge (www.medialounge.co.uk) is a specialist Magento agency in Bournemouth, UK. We’ve been working with Magento for 7 years and have built some really nice sites in that time. In my spare time, I also run a Magento store for Car Camera Shop (www.carcamerashop.co.uk).