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
7
votes
5 answers

Class usage in Python

I write a lot of scripts in Python to analyze and plot experimental data as well as write simple simulations to test how theories fit the data. The scripts tend to be very procedural; calculate some property, calculate some other property, plot…
Nope
  • 34,682
  • 42
  • 94
  • 119
7
votes
0 answers

return on negative condition vs if block

If I have a function which should perform an action on some condition, and returns null instead, which is cleaner: def func(): if not condition: return None [...] return asd or def func(): if condition: [...] …
yakxxx
  • 2,841
  • 2
  • 21
  • 22
6
votes
1 answer

Is it bad practice to mix OOP and procedural programming in Python (or to mix programming styles in general)

I have been working on a program to solve a Rubik's cube, and I found myself unsure of a couple of things. Firstly, if I have a bunch of functions that have general applications (e.g., clearing the screen), and don't know whether or not I should…
Jerry Wright
  • 77
  • 1
  • 2
6
votes
3 answers

OOP vs procedural in run-time

I have very simple question I cant find answer anywhere on the internet. So, my question is, in procedural programming, code is in code section, which goes into Read Only memory area. Variables are either on stack or heap. But OOP says that object…
B.Gen.Jack.O.Neill
  • 8,169
  • 12
  • 51
  • 79
6
votes
2 answers

What is this C function syntax?

I'd say I have intermediate experience with programming in c, however I've never seen this syntax used before to make a function. This reminds me of the syntax for a JQuery event. Overall, I'd like a detailed explanation of what this is and what the…
6
votes
1 answer

Pass table to postgreSQL function, execute select statement, return table

I'm transitioning to postgreSQL from MSSQL and still working out the syntax for procedural programming. The idea is to create a function that will take a table as an input/parameter, execute a series of SELECT statements against this input table (no…
Uncle Milton
  • 163
  • 1
  • 3
  • 10
6
votes
2 answers

which metric(s) show the difference between object-oriented and procedural code

Which metric(s) could help to indicate that i have procedural code instead of object-oriented code? I would like to have a set of simple metrics, which indicate with a high probability, that the analyzed code contains procedural transaction scripts…
6
votes
2 answers

How to use append-map in Racket (Scheme)

I don't fully understand what the append-map command does in racket, nor do I understand how to use it and I'm having a pretty hard time finding some decently understandable documentation online for it. Could someone possibly demonstrate what…
kjh
  • 3,407
  • 8
  • 42
  • 79
6
votes
3 answers

Alternative to polymorphism in non-OOP programming?

Assume we have a drawing program with different elements, such as circle, rectangle, triangle and so on. Different kinds of objects that will all need similar function such as draw() to display themselves. I wonder how would a programmer approach…
dtech
  • 47,916
  • 17
  • 112
  • 190
5
votes
1 answer

Understanding (sub,partial,full,one-shot) continuations (in procedural languages)

After reading almost everything I could find about continuations, I still have trouble understanding them. Maybe because all of the explanations are heavily tied with lambda calculus, which I have trouble understanding. In general, a continuation…
5
votes
1 answer

L System Node Rewriting example

This is my first post in stackover flow. Recently I started reading the book called "Algorithmic beauty of plants" where, in chapter 1, he explains L system. (You can read the chapter here). So as I understand there are two types of L systems. Edge…
5
votes
3 answers

How to generalize a sequential COUNT() of chronological data without loops or cursors?

I have read all the arguments: Tell SQL what you want, not how to get it. Use set-based approaches instead of procedural logic. Avoid cursors and loops at all costs. Unfortunately, I have been racking my brain for weeks and I can't figure out how to…
4
votes
4 answers

Smoothing issue with Diamond-Square algorithm

I am using the diamond-square algorithm to generate random terrain. It works fine except I get these large cone shapes either sticking out of or into the terrain. The problem seems to be that every now and then a point gets set either way too high…
4
votes
1 answer

if+override variable vs. if+else condition. Which is better, performance wise?

I want to use data-src attribute when screen.width > 767 and data-src-small when screen.width < 768. I have two methods in mind: Method 1: var src = "data-src"; if($(window).width() < 768) { src = "data-src-small"; } // do something with src…
user31782
  • 7,087
  • 14
  • 68
  • 143
4
votes
5 answers

Speed of finite state machines - OO vs procedural

Hey all, I am designing a program that will accept from input a series of tokens and feed them to a finite state machine which I have designed. I have designed a test finite state machine in object-oriented style, with structs for the machine itself…
1 2
3
16 17