Questions tagged [procedural]

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.

187 questions
6
votes
8 answers

How to write main() in an OOP way?

When I first started programming, I wrote everything in main. But as I learned, I tried to do as little as possible in my main() methods. But where do you decide to give the other Class/Method the responsibility to take over the program from main()?…
Srikanth
  • 11,780
  • 23
  • 72
  • 92
6
votes
2 answers

Procedural snare drum

So I've got something like: void createSinewave( short * array, int duration, int startOffset, float freq, float amp ) ; void createSquarewave( short * array, int duration, int startOffset, float freq, float amp ) ; Other functions "slide"…
bobobobo
  • 64,917
  • 62
  • 258
  • 363
6
votes
9 answers

Best way to explain declarative fallacy in C++?

How might one craft a good explanation of why the following code is not correct, in that the author is attempting to write C++ code declaratively rather than procedurally? const double NEWTONS_PER_POUND = 4.448; int main() { double pounds,…
ybakos
  • 8,152
  • 7
  • 46
  • 74
5
votes
7 answers

Understanding recursion in the beer bottle example

I am practicing recursion in C on my own and I found this example online. However there is one thing I don't understand. void singSongFor(int numberOfBottles) { if (numberOfBottles == 0) { printf("There are simply no more bottles of beer on the…
Ralph
  • 2,959
  • 9
  • 26
  • 49
5
votes
4 answers

Tiling Simplex Noise?

I've been interested (as a hobbyist) in pseudo-random noise generation, specifically the Perlin and Simplex algorithms. The advantage to Simplex is speed (especially at higher dimensions), but Perlin can be tiled relatively easily. I was wondering…
fbrereto
  • 35,429
  • 19
  • 126
  • 178
4
votes
2 answers

Which Scala function to replace this procedural statement?

Mindblock here, but I can't figure out how to make this less ugly: def getClosestSphere(ray: Ray, spheres: List[Sphere]): Sphere = { val map = new HashMap[Double, Sphere] for (sphere <- spheres) { val intersectPoint =…
Dominic Bou-Samra
  • 14,799
  • 26
  • 100
  • 156
4
votes
2 answers

mysqli_query($conn, $sql) or $conn->query($sql)

I am new to web Development, I am currently not using any frameworks. Till now, I was using mysqli_query($conn, $sql) to send a query to the MySQL server. Recently I read another technique which use $conn - > query($sql). I know that…
Ashwin K Joseph
  • 371
  • 2
  • 4
  • 14
4
votes
3 answers

C and OOP need a little bit of clarification

I'm currently doing a lot of programming in C. I am an undergrad student. The first language we learned was Java and now I'm learning C. In Java, we create a class and it's field variables (state) and a bunch of methods (or behaviours) for said…
Daniel
  • 49
  • 2
4
votes
4 answers

Python - Re-Implementing __setattr__ with super

I know this one has been covered before, and perhaps isn't the most pythonic way of constructing a class, but I have a lot of different maya node classes with a lot @properties for retrieving/setting node data, and I want to see if procedurally…
Pax
  • 237
  • 3
  • 11
4
votes
2 answers

Lua Separation Steering algorithm groups overlapping rooms into one corner

I'm trying to implement a dungeon generation algorithm (presented here and demo-ed here ) that involves generating a random number of cells that overlap each other. The cells then are pushed apart/separated and then connected. Now, the original…
BacioiuC
  • 73
  • 1
  • 5
3
votes
5 answers

Am I writing procedural code with objects or OOP?

So basically I'm making a leap from procedural coding to OOP. I'm trying to implement the principles of OOP but I have a nagging feeling I'm actually just writing procedural style with Objects. So say I have a list of pipes/chairs/printers/whatever,…
Matija Milković
  • 2,458
  • 2
  • 15
  • 27
3
votes
3 answers

PHP Procedural To OOP

I'm trying to convert my procedural code to oop.
markerpower
  • 345
  • 1
  • 4
  • 13
3
votes
1 answer

How to make the smoothing effect look more natural

I made a program in C# that generates maps in a procedural way. After generating the map, I need to somehow smooth out the edges, but when I do this via software, the output doesn't seem natural. This is the original map: This is the original…
3
votes
0 answers

Procedural Landscape Generation from Data (BP, C++)

in UE4 we want to create procedural landscapes from freely available geological and height data. We've been following the book "Unreal Engine 4 Scripting with C++ Cookbook", which is a little older. The code adapted accordingly also works well,…
Reiti
  • 57
  • 4
3
votes
2 answers

Initialize pointer(new uint8_t[height * width*3]) in one line

I am following a c++ course and there is something I would like to be able to do in one line. I have the following class: class example { private: int height, width; std::unique_ptr pointer = nullptr; public: example() …
1
2
3
12 13