Questions tagged [structured-programming]

27 questions
27
votes
3 answers

What's the difference between functional, structured and procedural programming?

I have read some articles on all subjects, but I don't quite get the differences.
18
votes
3 answers

How to set default template for new ".R" files in rstudio

Background: I like 'r'. I use Rstudio for it - it is a nice IDE. I use the revolution Analytics version of 'r', "revolution R Open". I find that I type the same stuff in the annotation and structured programming regularly, and I want to save…
EngrStudent
  • 1,924
  • 31
  • 46
10
votes
8 answers

How to do structured programming using blocks in Objective-C

When using methods which return blocks they can be very convenient. However, when you have to string a few of them together it gets messy really quickly for instance, you have to call 4 URLs in succession: [remoteAPIWithURL:url1 success:^(int…
8
votes
0 answers

Is there a reason for which Donald Knuth choose procedural programming instead of functional programming?

Donald Knuth's Art of Computer Programming Series uses his own procedural assembly languaged called MIX. Now, the question becomes: should Knuth have used a functional language to describe his algorihtms? Should TeX have been written in a functional…
7
votes
4 answers

Control structures beyond standard conditionals and loops?

Structured programming languages typically have a few control structures, like while, if, for, do, switch, break, and continue that are used to express high-level structures in source code. However, there are many other control structures that have…
templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
5
votes
0 answers

Why not "break break"?

Situation: You have a nested loop, and you need to break out of it. Let's take this classic example (classic because it came from Goto Considered Harmful Considered Harmful): Given a 2-dimensional NxN square integer matrix X, find the first row with…
leewz
  • 3,201
  • 1
  • 18
  • 38
2
votes
0 answers

Objects into functions

I have a question that my teacher asked me and I could not find the answer, I am still searching in pdf for public institutions how mit (which are public), utn or related, if anyone can answer me or tell me where I can find it, thank you. Objects…
1
vote
0 answers

C++ , Why the "double" data type is showing only 7 digits and not 15-16?

I'm new to c++ and i want to represent a value as accurately as possible using "double" data type , why pi & area values aren't represented fully here ?enter image description here expected that float and double will have different value…
1
vote
2 answers

Absolutely-DRY conditionals in a language that doesn't allow goto?

How do you fake conditionals that don't nest in a language that doesn't allow goto? I want to do the following: if (condition1) action1; if (!condition1 && condition2) action2; if (!condition2 && condition3) …
isekaijin
  • 19,076
  • 18
  • 85
  • 153
1
vote
1 answer

Is there any programming language which has a for-while loop?

This is what I mean by a for-while loop: for (; ) while (); It roughly translates to: while () { } This seems like a very common programming pattern. Yet, no language that I…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
1
vote
3 answers

What are some good approaches to organizing CSS files so that they are easy to maintain?

I'm not a pro. I have my business web site that has grown from 5 files to 300 files. My css file is now about 800 lines long, and it's getting difficult to manage. I've got a certain amount of cruft in it. The firefox extension 'Dustoff' helps. …
Sherwood Botsford
  • 1,889
  • 5
  • 20
  • 35
1
vote
1 answer

Fortran Modules - Variable declarations conflict in module with main program

I have a FORTRAN 95 code where, in the main program, these variables are declared: integer :: i real(8) :: dx real(8), allocatable :: X(:), Y(:), Z(:) The following function uses these values at some point during the…
Steve
  • 41
  • 6
1
vote
1 answer

Calling Static Method of Class WITHOUT classname, PHP

Maybe it's foolish question, And I want to implement some utils functions using OOP in PHP, instead SP (Strudtured Programming), but with uses like SP. An example: class A { public static function x() { echo "using x method!"; } } According…
user2730587
0
votes
2 answers

Have a routine handle special cases or split the code in n routines, one for each case?

I wonder what the best practice is for handling optional calls, special cases etc. within procedural code (PL/SQL without OOP). We have a program with lots of configuration and things that will or will not happen because of database state etc. In…
0
votes
1 answer

Structured Programming vs. Object Oriented Programming

In one class of my Structured programming course, the teacher told us that there are 3 way to decompose the problem to structured programming: Functional decomposition Algorithmic decomposition Object-oriented decomposition As far as I know,…
1
2