Just How should we be Coding?
Ask me what my job is and I’ll probably say I run a company. Ask me what my passion is and I’ll probably say developing. I’ve been coding with the odd time off for fun since I was 9/10 years old, I was the one hacking into Zalaga to get infinite lives (and succeeding) and transcribing assembly code out of a magazine just to get it to make a ‘rocket’ shoot into the sky.
That’s a few years. 30+ years of coding everything from Sparcs, Amstrads, BBCs’, PCs, Macs, C++ to Java to C#, Fortran to COBOL at school with a bit of Smalltalk and Pascal for good measure. MSIs, Ant, large scale deployments, LAMP, AWS, Docker, Vagrant, UML, Gang of Four, Rational Rose, etc etc etc, I’ve seen a lot. I have credentials, and I have zero to prove.
Now I’m not sure, maybe I’m getting old, or maybe my CEO hat is getting in the way, but over the last couple of years I’ve seen what I can only call ‘snobbery’ in programming. It might be because people treat me differently, they don’t realise I’m technical, I look over the hill, etc, etc, but actually I don’t think its just me, and quite frankly I think it needs to stop.
What’s important to young inexperienced programmers in my mind is that they code. Its not about so much how they code, its about them learning and furthering what they do, and when you are coding quite often you do not have all the pieces of the jigsaw, nor do you need them, you just concentrate on the portions you understand and slowly the picture will become clearer allowing you to tackle the more difficult parts and in some cases go back and refactor the parts you maybe did wrongly (maybe it’s more like Sudoku than a jigsaw, but you get the idea!).
Let’s look at Magento. When we submitted our MatrixRates extension initially it was refused for plagarism checks! Why, because I’m not a fan of coding for coding’s sake. MatrixRates was written in a weekend originally, and you know what it’s tablerates with some intelligent adjustments. It builds on whats there, its not aiming to win medals, its aiming to solve a problem that TableRates in Magento doesn’t — multiple shipping methods and better condition filtering. Thats it. Why should we write that from scratch? Magento spent a long time building their codebase, and they are spending a long time refactoring it. I want to be as close to their code as possible because that’s how I can keep it easy to maintain. So I’m not going to write a new import for it, the one that’s there works, it does a job, we extend it. We evolve. Computer science in my mind should be first about evolution, and about solving business problems. On top of this my goal here is not to be the best programmer in the world, I don’t have time to be. And neither do 99.9% of the developers in this world.
Does this mean we should write crap code? No, absolutely not. But let’s not get on our high horse about codebase, it depends who you are writing for. When I did the 1.x extensions on WebShopApps I did them to be sold. I needed to protect IP and one way I did this was but putting my unique stamp on the code. So rather than use an OO based approach in many cases I used associative arrays to hold the objects. Gasp I hear you say, what the hell?? Well you know what if you copy that and you have associative arrays that look like mine Im going to know you copied it. And I built a company spanning 3 continents like that. I solved business problems.
We should all be furthering ourselves, but we shouldn’t turn into snobs. We shouldnt be ripping apart other code. Where I feel that there are exceptions to this is if you are writing interfaces/apis for others to use. Ensuring backwards compatibility, ensuring adequately documented code, especially if you are writing for the open source community and wanting to encourage adoption are paramount. In ShipperHQ we take a different approach, we want developers to contribute to our extension, we want them to see the API and we need to ensure that the API remains backwards compatible. We have to consider different things.
It worries me what we see on the Magento Stack Exchange, where people raise questions and are shouted down — this is off topic, too vague, advertising, etc etc. I’ve totally come off there now because it feels like a testosterone battle, and because I only know shipping its hard for me not the advertise, I know what I sell! We are a community, lets help each other. If you are one of the ‘senior’ members then have consideration for when you were 22 and starting out. This stuff is hard, lets help. We don’t all talk the same language, and its okay, we don’t need to.
Rant over. Back to my passion.