Backend Development: Learn the Basics
We’ve already covered the introduction to frontend development, so now it’s time to focus on another side of the coin – backend.
Have you heard of the “Dyn Cyberattack” from 2016? Does the “WannaCry” ransomware case from 2017 ring a bell? Or maybe the Capital One data storage breach from 2019? All of these (and many more!) cases impacted millions of people all over the world and cost billions of dollars in lost revenue. There is also one more thing that the cases have in common: all of them could have been avoided with a higher level of system security or with more effort put into the architectural project phase – the backend development.
Complex and reliable applications are hardly ever single-module solutions. It takes a great deal of work to deliver a secure, scalable, maintainable, and user-friendly product. Usually, applications consist of some sub-projects:
- Infrastructure project for creating a self-deployable and easily configured environment
- Automatic tests suite for providing Quality Assurance and regression checks
- Frontend bundle for visual data presentation and handling interactions with user
- Backend service(s) for security checks, data retrieval and performing business logic
If the very last one is of most interest to you and you are a programming newbie, keep reading to learn Backend Development basics.
You probably know that frontend and backend operate separately. Let’s answer a simple question: “What is the purpose for such a split?”
Frontend vs Backend development
Frontend application code works on the user’s side (on mobile devices or in web browsers). If it was the only thing that stood between the user and the database, it would mean anyone could’ve edited the existing data of a given company. Any user would be able to make a mess in the database, gain access to other user data, delete it, etc. Which would mean a disaster for any business.
That’s when the backend comes in. It serves as a “middleman” between the frontend and the database. It authenticates the calling user, validates the incoming requests, prevents the database from being accessed, and handles all possible errors in a controlled manner.
Programming languages for Backend
Java for the win
For the rest of this article, we’ll stay with Java, since it is probably the most popular language out of those mentioned above.
Java is an object-oriented programming language, supporting multithreading and exception handling. Its code (priorly compiled to “bytecode”) is run on Java Virtual Machine (Java-dedicated runtime environment) which makes it platform-independent.
Another great feature of Java is the Garbage Collector – a built-in memory administrator, which relieves the programmer of the necessity to manage the object’s lifecycle personally.
Make sure to check this Java vs Golang comparison, if you’re looking for a more modern approach to similar benefits.
Is this the moment when you can finally write the first line of your newly invented application’s code?
Well, you can, as long as you’re willing to code everything from scratch by yourself. But why don’t just use so many years of experience that IT engineers all over the world have gained through all those realised (and non-realised!) projects? Here’s something that will help us solve technical problems that typically occur during application development.
Ladies and gentlemen, let me introduce you to:
A framework is a piece of software that you import into your project and it handles the main part of the functionality that the application is responsible for. All you have to do is to define business logic or business rules that you want to be applied to a given code fragment.
It’s as simple as that! No boilerplate code to write, no basic behaviours to outline just application flow with returned values.
Simplicity. Convenience. Clarity.
We’ve already explained some of the most popular frontend frameworks in detail, so now it’s time to focus on the backend!
When it comes to Java frameworks, there is an undisputed leader – Spring Framework. It is composed of many sub-frameworks for handling different parts of an application. The most popular are:
- Spring Boot – following a rule “Convention over Configuration” lets you create a basic (and working!) project in minutes with a possibility to easily adjust app configuration
- Spring Data – for creating a persistence layer
- Spring MVC – designed to support web applications
- Spring Security – to secure your application by providing users authentication, authorization and requests filtering
Spring also features a base project generator where you can specify the preferred language, the desired version of the framework and the dependencies that you will need. Then you click “Generate” and – ta-dah! – project is ready.
When talking about Java frameworks we have to mention Hibernate. It is one of the most popular implementations of Java Persistence API and is used as a default vendor in Spring Data.
Hibernate lets you bind Java entities with corresponding database tables. Such binding is called ORM – Object Relational Mapping. Although Hibernate makes life easier and is very convenient to use in the initial phase of a project, some developers complain about its efficiency and that too much uncontrolled “magic” is done under the hood.
Other Java frameworks
Alternatively, if you are an enthusiast of simple, concise code you should use Grails Framework instead, with its sexy Groovy language. On the other hand when you need to integrate with some legacy systems then the best choice for you is Apache Struts 2 Framework (slightly outdated but still very elegant and functional). However, if all you want is an easy and lightweight framework with basic functionalities – pick Dropwizard as your framework.
Here we are! As you can see, there’s quite a lot for you to choose from.
Now you’re ready to create your own backend application. Make us proud! Or, if you’re still feeling a bit insecure, we can develop a powerful backend for your website FOR you!