Technology

ECommerce for Dummies: Which Programming Languages Should I Use?

If you’re not from a tech background and you’re trying to build an eCommerce website, it can be overwhelming to see the number of developers and programming languages available. Should I be hiring somebody who uses Python? Java? Where does Ruby come into it? Which programming languages should you use for your eCommerce site?

JavaScript and PHP. 

There, I put the answer right at the top. It wasn’t hard. I’m going to go into why, but if you’re just here for the lowdown: 99% of eCommerce storefronts just use JavaScript and PHP and anybody telling you differently is probably selling something.

Wait, what about HTML and CSS? I’ve heard about those.

They’re used in eCommerce development but they’re not programming languages: they’re markup languages, which tell the browser what to show but not what to do. HTML/CSS/JavaScript/PHP are the four musketeers of website development, and together they form the backbone of the internet. It’s possible to use other languages, but they’ll do the job in almost every case, unless you’re trying to do something really different.

HTML and CSS are a very important part of that equation and shouldn’t be discounted, but they’re not what we’re here for today.

Untitled

Okay so, JavaScript and PHP.

Yep. There’s something called AJAX, which stands for Asynchronous JavaScript and XML. Have you ever clicked a button on a website, and had the entire page reload? AJAX changed everything by allowing users to change the contents of a page without needing to reload. It’s faster, it looks better, and it prevents strange bugs caused by forms reloading and the like. It’s an integral part of almost every modern website, and it’s one of the main uses for JavaScript (JS) in eCommerce sites.

With properly-configured AJAX, a user can add or remove items from a cart with minimal fuss. It’s also great for things like account creation, support queries, and any other form your users need to fill out.

Outside of just AJAX, JS can be used to add interactivity to web pages. JavaScript contains, well … scripts. A script is a predefined sequence of events that happens when you trigger them. So, for example: when a user scrolls down to this point in the page (the trigger) a newsletter subscription popup appears (the script). That’s what I meant be does stuff: JS can enact live changes to the page without needing to reload or change anything.

This is where a problem happens. A website has a front end, which is everything being displayed for the user, and a back end, which is storage and all sorts of mechanical stuff. JavaScript works almost exclusively in the front end (there’s something called Node that breaks this and I’d get endless comments about if I didn’t mention, but usually JavaScript is front end only) and can’t pull things up from the database, which is why we have PHP.

N.B. when we talk about building an eCommerce storefront, we’re talking almost entirely about the front end. The back end will use languages like MySQL and it’s a whole different can of worms.

PHP is a language whose job is to communicate with the back end, and pull things into the front end. If you’ve ever gotten an email that greets you by name, you’ve interacted with PHP. How that works is:

  • In the database, your email address and name will be stored together
  • PHP can see your email address, so it uses it to find your name
  • It inserts your name into a designated slot

On a website when you’re being greeted by name, a similar thing is happening. Have you noticed that happens more often if you’ve set up an account on the website? It’s because your name is now stored on their database, so PHP can pull it up easily. PHP developers help build bridges between your front end and back end.

Together, JavaScript and PHP cover programming for your storefront. HTML handles the words and images on the page and CSS handles the layout and general appearance. Put those four together, and you’ve got the front end of a vast majority of websites made in the last 10–15 years. JavaScript has dozens of different frameworks  that are all in competition with each other, but that’s another topic for another day.

What Aren’t Good eCommerce Storefront Languages?

You can use other languages except JS/PHP, but don’t trust any guide that says, for example, Java is the pre-eminent eCommerce design language. There are developers who work in that space, but they’re definitely not the norm, especially in 2019—Java (which is totally different from JavaScript) isn’t supported by most modern browsers and will cause major issues and bugs unless you’ve managed to score some sort of jerry-rigging code genius. Java is still used sometimes in back end web development and it’s a viable choice there, but it’s not a good programming language for the storefront itself.

Python also comes up in a lot of these guides for some reason, when in reality it’s more commonly used for data processing in the sciences, banking, heavy manufacturing etc. There definitely are eCommerce sites written in Python (usually using the Django framework but it’s a bit like making a pizza base out of muffin dough: it tastes fine, but it’s still a bit weird, and I wouldn’t trust the pizza opinions of anybody who said it was the default choice.

I have never seen an eCommerce storefront written in C using WebAssembly and I don’t know why you’d do that, but I’ve seen at least two different guides online recommending it. Don’t get me wrong, I love C, but it’s a very low-level programming language, meaning it’s very close to the language that computers actually read and process in. A low-level programming language allows a lot of fine control but also takes more work to read and write; writing an eCommerce storefront in it seems like a lot of effort for the same result. eCommerce programming tends to be fairly basic: it’s things like “click buy, credit card payment goes through”, which higher-level languages like JavaScript can do just fine. C is for writing software, and it’s massive overkill for designing websites.

Okay so the correct languages for eCommerce front end are JavaScript and PHP?

Yep, the correct languages for eCommerce front end are JavaScript and PHP. I wouldn’t chase off a developer saying they’re going to work in something different, but I’d definitely ask why. Sometimes other languages are the correct choice, but JS/PHP are the normal programming languages for the front end and they’ll almost always do the job unless you’re trying to do something very specific.

And that’s that! Good luck out there.

Related Articles

Back to top button
Close
Close