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.

193 questions
6
votes
1 answer

Parametric Random Function For 2D Noise Generation

I'm attempting to generate infinite random terrain. The terrain should generate the same every time given the same seed. I've tried using Java's Random function, creating the seed using various functions of the x and y co-ordinates of the given node…
JamieEclipse
  • 83
  • 1
  • 8
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,148
  • 20
  • 64
  • 87
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
  • 57,855
  • 58
  • 238
  • 337
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
  • 6,503
  • 3
  • 38
  • 69
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,719
  • 7
  • 21
  • 43
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
  • 34,250
  • 17
  • 118
  • 176
5
votes
7 answers

OO or procedural

I have an Access db I use for my checkbook (with a good amount of fairly simple VBA behind it) and I'd like to rewrite it as a stand-alone program with a SQL backend. I'm thinking of using either C++, Java, or Python. I had assumed, before I…
ChrisC
  • 1,315
  • 5
  • 18
  • 35
4
votes
3 answers

Teaching an old dog new tricks

I have a great manager who was a procedural coding wizard in his day. He is now faced with managing a team which uses object oriented programming in both .Net and Java. He struggles to understand a lot of the patterns and terminology we discuss. I…
northpole
  • 9,788
  • 7
  • 33
  • 57
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
  • 13,072
  • 26
  • 92
  • 146
4
votes
4 answers

When are TSQL Cursors the best or only option?

I'm having this argument about using Cursors in TSQL recently... First of all, I'm not a cheerleader in the debate. But every time someone says cursor, there's always some knucklehead (or 50) who pounce with the obligatory 'cursors are evil'…
Chains
  • 11,681
  • 8
  • 40
  • 61
4
votes
1 answer

Generating a city/town on a grid (Simply my approach)

Problem I am trying to make a city generator for a game that creates blocks that have a type (residential, industrial, commercial). All of my streets will be at 90 degrees and there for I want it to be blocky (instead of zig zagging). Approaches My…
Joe Jankowiak
  • 684
  • 8
  • 26
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
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
  • 13
  • 26
3
votes
3 answers

PHP Procedural To OOP

I'm trying to convert my procedural code to oop.
markerpower
  • 335
  • 1
  • 4
  • 13
1
2
3
12 13