Questions tagged [procedural-programming]

Procedural programming is a term used to denote the way in which a computer programmer writes a program. This method of developing software, which also is called an application, revolves around keeping code as concise as possible. It also focuses on a very specific end result to be achieved. When it is mandatory that a program complete certain steps to achieve specific results, the code is said to have been written according to procedural programming.

Procedural programming is not always the preferred method of coding applications. Software that is highly complex can require literally thousands of lines of code, making it somewhat more difficult for a team of people to work with it. Some programmers hold the opinion that extremely large applications can become difficult to maintain even by one developer.

Some people wrongly believe that it is impossible to write very large or complex software in a procedural programming language. Certain programs might be more easily written using Object Oriented Programming (OOP), but this does not mean that they cannot be developed procedurally. The Linux kernel, which is the core of an open-source operating system, is written using procedural programming. Other major applications such as the Apache server, the Drupal content management system and Samba, are all written in this manner. These applications are large and are considered to be complex by the overwhelming majority of programmers.

Among the procedural programming languages in existence are C, Fortran and Python. Many important applications and utilities have been coded in such languages. For example, Anaconda, the installer for Fedora Linux, is written in Python, as are various software managements tools.

Imperative programming is another term used to signify this type of development.

252 questions
4
votes
1 answer

Is there a way to use procedural code with SQLite3?

I prefer to use procedural style code, is there any way to use procedural style code with SQLite3? Or is the only alternative to create the functions as aliases (which seems like a stupid idea) I would prefer to use something like sqlite3_open() if…
cantsay
  • 1,967
  • 3
  • 21
  • 34
4
votes
2 answers

Optimize Java 8 functional algorithm compared to its procedural counter part

I'm trying to optimize a functional operation in Java 8 compared to its procedural equivalent but I'm having some serious performance issue. Situation I must parse HTTP Headers String, List from the value of a given enumeration which maps a…
4
votes
3 answers

Why distinction between expression and statement

In lots (actually all I've ever used) of functional languages there is no distinction between a statement and an expression and the last value of each code block is the "return value" of the block. On the other hand languages not generally…
Voo
  • 29,040
  • 11
  • 82
  • 156
4
votes
1 answer

Procedural approach in JavaScript

I recently watched a JavaScript video tutorial containing code similar to this one: (function (){ var b = 10, c = 20, d = 50; var e = function(){ return b + c + d; }; return e(); }()); This is a common JS…
Miroslav Trninic
  • 3,327
  • 4
  • 28
  • 51
4
votes
2 answers

Objects without classes - data model in 'clean C'

I've worked with C++ on some medium-sized project, but I have never did any serious programming in C. Having read this article I've started wondering how I could use C++11 without classes and exceptions. I once heard the term clean C. Clean C…
user1333261
3
votes
4 answers

Are there advantages to the C approach over the C++ approach at times?

I've been mulling this over in my head lately. Most of us are well aware that in C, in order to create a struct, you normally prefix it with a typedef to avoid calling the struct keyword before referencing the object. Of course, C is limited to…
zeboidlund
  • 9,731
  • 31
  • 118
  • 180
3
votes
4 answers

Is OOP necessary in PHP sites, can't I just apply its concept to procedural code.... cake and eat it?

I know there are countless questions about the difference between OOP and procedural, when to use either and whether the benefits outweigh the extra overhead, learning the syntax, inheritance confusion, etc. Most of what I've found tends to just…
Taylor
  • 1,700
  • 4
  • 17
  • 18
3
votes
1 answer

How to Transform Graph into Grid Map?

I'm making a program that implements procedural content generation (PCG) to create maps in a 2d game. I use the graph data structure as the basis. then the graph will be transformed into a map like in the example image I attached. with graph…
3
votes
1 answer

Why is OOP juxaposed with Procedural Programming?

From what I understand, procedural programming is a programming paradigm whereby the state of the program is determined by procedures that handle the flow of data, such as subroutines and data-fed function calls while an object oriented program is…
Mode77
  • 991
  • 8
  • 28
3
votes
7 answers

When to switch from procedural to OOP?

In most discussions of OOP it's said that the advantage is re-usability.. You put in some extra work to define your classes, and it saves you time later in being able to create many instances and extensions of those objects. A corrolary of this…
Ben G
  • 26,091
  • 34
  • 103
  • 170
3
votes
3 answers

A PHP design pattern that is not OO, PHP pattern best suited to this situation

We were given a php inventory program. We are then supposed to say if a design pattern will make the program better or if it will just make the program more complicated. The program is structured like this. The program is broken down into php…
3
votes
3 answers

What is a good example that shows the difference between OOP and procedural programming in JavaScript?

I can't get my head around OOP in JavaScript. Many years ago, I used to dabble in programming BASIC and learned a bit of COBOL and FORTRAN in school so I am somewhat familiar with procedural programming, but I never learned any of these to a very…
3
votes
4 answers

Java Class Misuse - Best Practices

I'm fairly certain that I am not doing something class related correctly. I am using a class to create a set of variables (like a javascript object sort of maybe but not really). I am using it as shown bellow (a basic example) public class myScript…
TheLovelySausage
  • 3,838
  • 15
  • 56
  • 106
3
votes
2 answers

In non-procedural languages, what specifies how things are to be done?

If you compare C vs SQL, this is the argument: In contrast to procedural languages such as C, which describe how things should be done, SQL is nonprocedural and describes what should be done. So, the how part for languages like SQL is…
Moeb
  • 10,527
  • 31
  • 84
  • 110
3
votes
2 answers

Design Patterns and Encapsulation for Procedural Programming?

I'm working on a fairly large PHP project written in a procedural style (it was written before PHP 5), and I can't help but feel that some of the things I'm doing are a little "hackish." A modification somewhere else can easily break the…
ektrules
  • 405
  • 3
  • 9