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
3
votes
2 answers

Is it ever justified to write a fairly large, database-centric PHP app procedurally and without MVC?

Sorry for the rather subjective question, but I was hoping to get an opinion from someone more experienced than myself on this. I'm pretty far into an ajax-driven PHP application and, while I have pretty good separation between markup and behavior…
Greg
  • 7,782
  • 7
  • 43
  • 69
3
votes
5 answers

Is it better practice to have 2 functions, or 1 complex function?

I'm curious as to what is considered better practice in the programming community. On submit, a function is called, where some validation is done, and then a post is made through AJAX. I was considering having a function handle them both. I would…
user2592690
  • 265
  • 2
  • 11
3
votes
3 answers

Differences in procedural and object-oriented implementations of mysql in php?

Is there a significant difference in using an object oriented approach over a procedural approach when implementing mysql in php? On the php website about mysqli_query, (http://www.php.net/manual/en/mysqli.query.php), it provides an example of…
JPeroutek
  • 558
  • 1
  • 7
  • 20
3
votes
3 answers

procedural generation of spaceship sprites

I've been researching this topic for a couple of days and have an idea how how it might work, but I thought I'd post here for some other ideas. What I'd like to do is generate spaceship sprites/images to be used in a game. The look and feel should…
jpreed00
  • 893
  • 8
  • 25
2
votes
2 answers

How to port a Procedural project into an OO project

I have a small PHP project (about 3000 lines) and I need to make a BASIC UML model of it, starting with cases of use diagram, sequence diagram and states diagram, probably classes diagram, and maybe extend it with collaborations diagram. I'm new to…
NotGaeL
  • 8,344
  • 5
  • 40
  • 70
2
votes
0 answers

PHP OO Performance when generating thousands of an object type

I've been reading the Matt Zandstra PHP Object Oriented Designs and Patterns and quite liked an idea but was wondering how it effects PHP Performance when you create hundreds maybe thousands of them. You have a map consisting of thousands of…
creamcheese
  • 2,524
  • 3
  • 29
  • 55
2
votes
10 answers

Looking for example program written in different languages

As a way to understand the differences between OOP and Procedural languages I was looking for a sample program written in C and C++ or C# or Java. I just want to see the different approaches to the same problem to help me get a sense of the real…
jumbojs
  • 4,768
  • 9
  • 38
  • 50
2
votes
0 answers

Can a procedure, contained in a module, call another procedure contained in the same module?

Consider a module that generates the first few primes: module module_primes contains function is_prime(n) ! Function to check if a number is prime. implicit none integer :: n, m logical :: is_prime is_prime =…
2
votes
1 answer

Explain Robin C. Martin's "Clean Code" on Procedural Programming vs OOP

Robin C. Martin's "Clean Code" features a section on Procedural Programming vs Objected Oriented Programming which makes a few statements that I was not able to wrap my head around. Could someone care to explain in further detail the thought process…
Miguel Pais
  • 73
  • 1
  • 5
2
votes
4 answers

OOP for procedural programmers

I've been tied to several procedural applications written in PHP over the past 10 years. Two of these are going away soon, and I need to get up to speed with OOP techniques. Are there good tutorials or books written for people who are skilled…
a coder
  • 31
  • 1
2
votes
3 answers

Do C functions generally have more arguments than OOP languages' methods?

I had to write a C program with more than 600 lines and about 25 functions. This is the longest C code that I've written. I noticed that some of the functions have more than 5 arguments. The ones that are directly called from main() have more…
Matt Yoon
  • 396
  • 4
  • 11
2
votes
0 answers

Create pseudorandom seed from string in C#?

For a pseudo random generator (game-related) I need to create a seed from a string. It's not for security, but I still prefer this seed to be as random as possible. I don't use GetHashCode(): the implementation might differ per .NET version. I'm…
Dirk Boer
  • 8,522
  • 13
  • 63
  • 111
2
votes
2 answers

What is the difference between object oriented programming and procedural programming?

From what I can gather procedural programming uses procedures and functions or sub routines. It gives a step by step instruction on what to do. Though object oriented on the other hand im not entirely sure. All I have seen is that it uses "objects"…
Lewis Roberts
  • 57
  • 1
  • 6
2
votes
1 answer

2D perlin noise appears to be boxy

I seem to be getting boxy perlin noise terrain on 2d input. I have been following this https://www.shadertoy.com/view/4tGSzW, which uses WebGL instead of opengl. Where i have replaced the gradient method of taking from some sample texture by a…
ashish
  • 23
  • 5
2
votes
1 answer

procedural code, vs oopy code and performance

I've written a backend app for use with a iOS App. When I started the project, I didnt know OOP at all. Now half the scripts are classes and I am using a mvc pattern and classes. It sure is easier to reuse my methods now, but now there is alot more…
Peter
  • 2,276
  • 4
  • 32
  • 40