Posted on June 18, 2010
As you probably are aware by now, MVC on its own tends to make me want to scream at developers that there is more to life than butchering models….
So I’ve come up with a fundamentally better way of developing. You CAN keep your components decoupled and still use MVC… Crazy I know. But I’ve had a brilliant idea in which this could in fact work and be far more appropriate for the scale that projects get now.
In the past, websites were really rather small. It was quite rare they had much more to do than process some forms go talk to a database for some dynamic data occasionally. There were some monsters of course such as ebay, amazon, search engines etc.. but generally speaking most companies’ online presence was rather small scale compared to today.
Today, web applications have grown exponentially due to the power of web languages and the fact they work with more standalone technologies and languages so well. In PHP this has led to a boom in MVC architectures so provide a pattern that allowed a scalable model led development. Object oriented development also enabled good programming practises to be used and therefore give web the scope it needed to grow. However, I think web applications have again outgrown their current trends… Read More
So you have a Magento site? Do you want to embrace the not so new world of mobile? Well here’s an idea of how to do it.
The great thing about Magento is that you don’t have to embrace the full MVC framework of it. Magento has built in 3rd party access in the form of web services and apis. Although these api’s use the Magento framework, you can bypass the whole theme business of it by using these apis. One thing you have to take into consideration is that there are more things to think about than just the site itself and how it looks.
For wap – you have to take into consideration device recognition. There are a few ways to do this, some really hard to maintain and a few tricks of the trade. One option is to use UAProfs(User Agent Profile). These are xml files that contain device capabilities and the location of such is usually found in the headers when a mobile device browses to your site under ‘X-WAP-PROFILE’. The only problem with this approach is that these files are often out of date and quite often comprise of malformed xml which can provide lots of headaches. I would not suggest this method to anyone these days as there are solutions that you can use. WURFL is a database of device capabilities based on the user agent that you get everytime in the http headers. There are others as well but WURFL has the benefit of being free! Yay! An example of a paid service is Device Atlas – but you know how much I hate paying for things :D. WURFL also has a nice companion called TeraWURFL which is a PHP extension. Very useful for Magento which is also written in PHP..By extracting display functionality from Magento and keeping the Magento installation purely functional, you can speed up your wap site considerably. Mobile themes that come with Magento use the whole framework which over even a 3g network, can take a long time to work. Especially if you want to have device recognition and especially if you want any type of subscription service (SMS alerts to customers or taking money through SMS as you will also need to use operator, territory, MSISDN identification which done incorrectly can add precious seconds on load time….) you will need to really interogate your load times for all these services to be called and established.
Device recognition is not built into Magento so you need to incorporate this in yourself. Since mobile sites often lend themselves much more nicely to SOA, I would not bother integrating it into Magento. Magento’s API’s make a nice section of your SOA structure to do all your store needs without having to use the full blown Magento architecture.
More info on wap development along with device recognition to follow rather than a tangent here!
The great thing about the APIs as well is that while your wap store is making some monies for you, you can use the Magento apis again to create your own mobile apps for smart phones such as IPhone and Android devices.
Be aware that IPhone apps have to be vetted by Apple so make sure you read up on their specs! The less functionality you keep on the ph0ne in the app itself the better. It’ll run faster and provide a much better user experience and the apps come really in handy for that so that only display is dealt with on the actual device. You can use SOAP or REST with Magento (I prefer SOAP due to most people completely misunderstanding REST, if anyone says they completely get it, I would take a lot of convincing to believe them!), it is not platform dependant. If you create an extension of Magento using a nice SOA gateway, you can provide for all your mobile needs by keeping Magento doing what it does best, product management and store functionality.
So, I’m a subscriber to PHP|Architect (http://www.phparch.com/) and am usually quite impressed by the articles that come out of it. I’m lucky enough to be buddies as well with one of the tech editors that makes sure the articles are a. well written and b. technically accurate and not rubbish. It’s super cheap for an annual subscription and I absolutely suggest it for any PHP developer who wants to be better than the average ones we seem to have a lot of these days….
One article that was in the April edition was “How to build your own CMS”. Apparently the article nearly didn’t make it in for whatever reasons I don’t know about, but I was pretty upset that the code within it was so out of date and against best practise. I was also upset at the article not containing reasons why commercial companies and budding developers should sometimes be very wary of this approach. Hence this latest “blant” 😀
Some of the advantages of building your own CMS for a developer that wants to move their knowledge from Web Developer to Programmer are obvious. While creating components that are used such as user management, effective caching, article management, effective db schemas and all that other jazz, this is a very informative exercise. IF you make sure you research/learn good techniques to do them. If this is the reason that you are building a CMS then I applaud you for your quest to further your knowledge. I really do. In some jobs, I’ve relearnt some basic PHP programming that really helps in all aspects of my programming career that can sometimes be waylaid/taken for granted/forgotten. This knowledge being at the forefront of your brain while developing can also mean that you can improve functionality and wrap it to suit your business needs better. By building your own system for content management you sometimes may also have an upper hand when using a new CMS that you’ve previously had no experience with to edit.
However saying that, I am hugely against using your own CMS for production purposes and for learning on your own. I am definitely one of those “please don’t make me rewrite the wheel..” kinda gal and unless I have a seriously good reason for writing my own management software from scratch, I avoid it. Most CMS’ out there (Joomla, Drupal – even though I hate it’s procedural rubbish, Magento etc) have a huge community following. This is great for several reasons:
- If you have trouble with something, chances are someone else has tried before and has the solution already. In a commercial situation time is money and speeding up processes like using tried and tested solutions that are already there are a big saving.
- If you are really into developing your own stuff, there’s always loads of room for you to develop things for viable reasons (such as the current solution sucks, there is no solution yet etc) so you can still get your kicks developing new things. For an example, I’m currently planning to develop a new component for Zend Framework that I need and hasn’t been done yet.
- Alot of good CMS are pretty hot on keeping up with best practises and moving with the times. It’s a trick to know which ones to go with but with a little play around you soon find your feet. This is all helpful in not only helping you keep up to date, but saves frustration at outdated code. It’s REALLY difficult keeping your own CMS up to date…
- Resources that you need in order to refine, develop, review, test your own CMS is really high. There’s nothing like releasing a beta to a community to iron out those bugs!
These are just a few. I firmly believe that the best thing for any budding PHP developer that wants to go from developer to programmer needs to follow these simple steps.
- Subscribe to blogs and technical articles (such as PHP|Arch).
- Question EVERYTHING. If you think you have a better solution or you don’t understand why a certain solution works so well, just ask! We’ll either explain or go; “Wow, actually that’s a good point!”
- Look for those jobs where you have a lead/senior programmer who blogs regularly, is an advocate for simple solutions, is always looking for the next best thing out there (frameworks, CMS, libraries etc) to play with but keeps an open mind to how effective they really are. They will teach you loads.
- Remember that senior and lead doctors, architects, lawyers etc spend maybe 10/15 years getting to that position where they hold a major stake in opinion. Of course you will get the prodigies who pick it up in 5 mins but be wary of people who believe they know most things and have only been doing it for a short period of time. It’s very likely they’re teaching you bad habits.
It’s for these reasons that I think building your own CMS can actually be a detrimental way of learning this stuff without the input from much more experienced developers. By using community based projects you can have input but more importantly learn from those that have been doing this for a long time. As you progress, you’ll often find that you have better ideas than some of these “Masters” that have well founded basis in best practise and are up to date and that comes with experience, guidance and practise. When you build your own, you’re often learning on your own and that’s usually never as successful.
If you want your own project, don’t go for a CMS, there’s loads. Think of something original that you can use to learn this stuff. Perhaps using a framework such as Zend or something that you can have the best of both worlds!!
From someone who is going from “Developer” to “Programmer” and is still learning after 4 years commercial, 5 years in total! My old (very clever) colleague is still even now an invaluable source of knowledge I hope to gain as I go on! It’s ok to ask for help
Magento for Ecommerce Introduction
So what is Magento?
Magento is an open source framework/application for E-Commerce web sites that is built upon Zend Framework. In the PHP world, Zend Framework is a very popular and highly respected framework. The great thing about Zend Framework is that it is first and foremost, a code library. Built within that library is an application layer that enables Zend Framework controlled MVC behaviour. However, you do not need to utilise this functionality in order to use Zend Framework thereby making it highly flexible. I digress..
Magento was originally designed to give businesses a platform on which they could provide an online solution for their commercial aspirations while also providing a highly extensive “Back Office” to administer the site from site design to product and order management. Along with this, Magento comes with a fully functional user area which is account management for your customers.
Varien (who own and develop Magento) have made the platform scalable by abstracting everything into objects and attributes. Attributes can be applied to any object and an object is an independent object who’s dependencies are not defined by process alone. This means that from an architect’s perspective, while we are primarily working in MVC (which is not my favourite architecture granted, but it works this time), manipulating objects on an API (Application Programming Interface) level is completely possible. This means that your developer can extend the platform to meet any business logic and work cross platform using any web service such as SOAP (Simple Object Access Protocol) or REST (Representational State Transfer). On some Magento projects, I have had to integrate with separate inventory and warehouse systems with 2 way communication between each system. The API functionality became essential at this point.
So WHY Magento?
Well this is a very difficult question to answer unless you as a company have a clear idea of what you want for your online store. However, thanks to Magento being completely flexible, it can be configured/extended/upgraded to professional or enterprise to suit any needs. There are also, like most CMS systems these days, a large backing from the community who develop plugins to add that extra functionality you may need or more importantly, want!
From a developer’s point of view, Magento follows programming best practises. The code is clean and documented and due to Magento utilising Zend Framework’s functionality for MVC structure with XML configuration, bespoke pacakges can be added with ease. In fact, Magento would teach budding developers crucial techniques for commercial development. For example, most applications will force you to copy code into a new class in order to add bespoke functionality. The XML configuration allows to add new levels to the class naming convention, meaning we can create local classes to EXTEND the main. No copying and pasting here! This means that when we upgrade Magento for new features and improved functionality, your bespoke code gets automagically upgraded too. A very nice feature for programmers indeed. Code should only ever be written once and be available everywhere it is needed.
Magento will happily either manage your static pages through its CMS system built in, but it will also become just a store front for the rest of your site. Due to it being completely open source, its appearance can be completely configured using normal web development techniques to integrate your style 100%.
Best of all – Magento Community addition is FREE! Yes you read right, gratis! This significantly reduces cost on using 3rd party software which means every penny can then be spent on all those extras you want. A fully functioning site with all your bells and whistles without the necessary time to build a system from scratch.
Sounds good to me!
Magento tips to follow…
For more information: http://www.magentocommerce.com/
So… after my post about MSG, all of which is true by the way apart from being not the whole story it turns out. I have more to embark on my quest to rid myself of the dreaded “diseases” caused by my rubbish food problems. I think the turning point was to find out it wasn’t just a food problem which has made it much easier to pin down.
All in all – I’m horrendously allergic to: Corn. I don’t have to carry an epi-pen or anything as it’s just very nasty, but has not threatened my life on that scale so far. I’m very glad of this – but at least that way the doctors might have taken me a bit more seriously instead of accusing me of being a mental! Bankers indeed.
So what has led me to this conclusion? Well, in order to avoid anything MSG, Andrew and I decided that we would make our own gravy from the juices of the meat, green water and flour. We kept forgetting to get corn flour so we were making it with plain. Very nice and my roast dinners were going very smoothly without any reaction. I remembered one week (a few weeks ago now) to get cornflour as it makes a nicer texture for gravy and that was ooonomnom! However, I then had a huge reaction where anti histamines were an absolute must as long with some anti emetics as well. This was super crazy for us as we had been so careful to avoid any MSG!!!! The only different ingredient was in fact the cornflour. So… more research I did on that.
I found out that there is a few people who have documented their allergies to corn online and blogged about them previously. I found that of course my reaction symptoms were the same as theirs due to it being your normal allergic reaction which could to be honest be attributed to anything! But when I saw the list of things to avoid being larger but including all of the MSG list I’d already been following, it all started to click. MSG of course being one of them since most factoryMSG additives such as anything hydrolized or autolyzed is made from corn syrup. Makes more and more sense! Corn syup and corn oil is the blight of American fast food and while MSG is really bad for you, the corn derivatives that make also are.
In addition to this, I have had terrible problems with ecsema on my scalp for years and years. When it gets too painful to bare, I switch to a shampoo that has always within a couple of weeks cured it and been fine for a while on my normal more commercially beautific (I know it’s not a word, I made it up, good though!) shampoos that make your hair smell and feel scrummy. As I was laying in the bath last night feeling rather sorry for my poor scalp being in lots of pain again, I thought I’d read through the different ingredients of my usual shampoo to my medicated stuff. Well, I found “Hydrolyzed vegetable protein”, “Citric Acid”, “Sodiam Triosphate”, “Glycel Distearate” amongst others. All derivatives of corn! My medicated stuff has no corn derivatives in so no wonder my poor skin likes it better!!
So: another list to avoid if you want to cut out the nasties of corn, it’s a leading cause of obesity anyway. Sweetcorn and corn on the cobs and things don’t seem to upset me as much at all, only when they start messing about with it do I really react. Just goes to show that nature doesn’t like me eating rubbish!!!
Things to avoid:
- Acetic Acid
- Alcohol (WAAAAAAHHH!!!!!)
- Alpha Tocopherol
- Artificial Flavourings
- Artificial Sweetners
- Ascorbates (preservative most widely used.. bah!!)
- Ascorbic Acid
- Baking Powder
- Barley Malt (can be ok, but is usually contaminated)
- Bleached Flour (check this as well)
- Blended Sugar (Sugaridextrose)
- Brown Sugar if it contains a Caramel colour additive
- Calcium Citrate
- Calcium Fumerate
- Calcium Gluconate
- Calcium Lactate
- Calcium Magnesium Acetate (CMA)
- Calcium Stearate
- Calcium Stearoyl Lactylate
- Caramel and Caramel Colour
- Carbonmethylcellulose Sodium
- Cellulose Microcrystalline
- Cellulose Methyl
- Cellulose, powdered
- Cetearyl Glucoside
- Citric Acid (Unless stated from fruit)
- Citrus Cloud Emulsion (CCS)
- Coco Glycerides
- Confectioners’ Sugar
- Corn Alcohol/Gluten
- Corn Extract
- Corn Flour
- Corn Oil, Corn Oil Margerine
- Corn Starch
- Corn Sweetener/Sugar
- Corn Syrup, Corn Syrup Solids
- Corn, PopCorn, CornMeal
- Crosscarmellose Sodium
- Crystalline Dextrose
- Crystalline Fructose
- DATUM (a dough conditioner)
- Decyl Glucoside
- Decyl Polyglucose
- Dextrose (found in IV solutions.. eep!!)
- Dextrose anything at all
- d-Gluconic acid
- Distilled White Vinegar
- Drying Agent
- Erythorbic Acid
- Ethocel 20
- Ethyl Acetate
- Ethyl Alcohol
- Ethyl Lactate
- Ethyl Maltol
- Flavourings (Unless specified what they are and no corn is present)
- Food Starch
- Fructose (Unless stated where from)
- Fruit Juices when from concentrate
- Fumaric Acid
- Germ/Germ meal
- Gluconic Acid
- Glucono Delta-Lactone
- Glucose (unless stated where from)
- Glucose Syrup (also found in IV solutions…)
- Glutamate (ahh my dear old friend)
- Gluten (though I ignore gluten from wheat…)
- Golden Syrup (Only can eat tate and lyles as specified as being from sugar beet)
- Grits (they are ewww anyway)
- High Fructose Corn Syrup
- Honey (in some cases, buy local if you can)
- Hydrolyzed anything
- Autolyzed anything
- Hydroxypropyl Methylcellulose
- Hydroxypropyl methylcellulose pthalate (HPMCP)
- Invert Sugar/Syrup
- Iodized Salt
- Lactic Acid
- Lauryl Glucoside
- Linolec Acid
- Magnesium Fumerate
- Malic Acid
- Malonic Acid
- Malt Syrup
- Malt, Malt Extract
- Methyl Gluceth
- Methyl Glucose
- Methyl Glucoside
- Microcrystalline Cellulose
- Modified Cellulose Gum
- Modified Corn Starch
- Modified Food Starch
- Modified Starchs in general!
- Mollasses (know your product, some have corn in)
- Mono and Di Glycerides
- Monosodium Glutemate
- Natural Flavourings (uh huh!!)
- Polylactic Acid (PLA)
- Polyvinyl acetate
- Potassium citrate
- Potassium fumarate
- Potassium gluconate
- Powdered sugar
- Pregelatinized starch
- Propionic acid
- Propylene glycol*
- Propylene glycol monostearate*
- Salt (iodized salt)
- Semolina (unless from wheat)
- Sodium carboxymethylcellulose
- Sodium citrate
- Sodium erythorbate
- Sodium fumarate
- Sodium lactate
- Sodium starch glycolate
- Sodium stearoyl fumarate
- Sorbic acid
- Sorbitan monooleate
- Sorbitan tri-oleate
- Sorghum* (not all is bad; the syrup and/or grain CAN be mixed with corn)
- Splenda (Artificial sweetener)
- Starch (any kind that’s not specified)
- Stearic acid
- Sucralose (Artificial sweetener)
- Sugar* (not identified as cane or beet)
- Tocopherol (vitamin E)
- Treacle (aka golden syrup)
- Triethyl citrate
- Unmodified starch
- Vanilla, natural flavoring
- Vanilla, pure or extract
- Vegetable anything that’s not specific*
- Vinegar, distilled white
- Vinyl acetate
- Vitamin C* and Vitamin E*
- Xanthan gum
- Zea mays
Well.. doesn’t that look like fun. The point of all those weird ones you don’t get in food however is that you get them in soaps, toothpastes, mouth wash, washing powder etc. Time to check everything!!!! I got this list of a site dedicated to corn allergies but it does have some missing. I’ll update that when I can be arsed I guess hehe.