What Is Procedural Programming?
Procedural programming is like a box of chocolates. You never know what you're going to get! Procedural programming is a programming paradigm that uses a linear or top-down approach. It relies on procedures or subroutines to perform computations, and it's procedural in the sense that it depends on techniques to perform tasks. This programming style can be divided into two categories: imperative and declarative. In imperative programming, instructions are given in a specific order: first this, then that. In declarative programming, instructions are provided but not necessarily in any particular order: here's what needs to be done; do whatever you want. In procedural programming, you take a top-down approach to solving problems. You break your problem into smaller subproblems and write procedures to solve those more minor problems. Then, with the help of those procedures, you solve the more significant problem. For example, let's say you're trying to write an app that guesses your weight given your height. You could break this problem into two parts: calculating the person's height and then calculating their weight. Once we have those two pieces solved, we can use them together to calculate a person's estimated weight! When you write procedural code, you're just writing a bunch of procedures that operate on data. You can't do anything to the data except through the procedures. That's why it's called procedural programming: it treats data and procedures as two separate entities. That's not to say it doesn't scale healthy procedural code is pretty easy to maintain and extend because there are no dependencies between the different modules/procedures. If you want something more modularized and easier to maintain and develop, OOP is probably your best bet. With OOP, your whole program is built from objects. An object is just an instance of a class—an encapsulation of data (called fields) and the procedures (called methods) that manipulate them. In most cases, the fields can only be accessed or modified through the methods. So basically, what happens when you make an object? You create this little self-contained mini-program or component! That means all these things are connected in one place instead of spreading across multiple sites, like if your whole program were procedural code (which could get messy).
Related Terms by Software Development
Join Our Newsletter
Get weekly news, engaging articles, and career tips-all free!
By subscribing to our newsletter, you're cool with our terms and conditions and agree to our Privacy Policy.
