Quote:Original post by DrPizza
And this is bad why?
Because OOP was developed to minimise the potential failures that such a linear structure can have.
Quote:Original post by DrPizza
And this is bad why?
Quote:The underlying implementation may be, but the end user usage is somewhat more abstract.
Quote:The methodologies are quite distinct.
Quote:The most common langauge, C++, enforces no such restrictions [on how operations are organised].
int a = 0, b = 1;a = 2; // 1b = a; // 2a = b; // 3
123: a == 2, b == 2: ok132: a == 1, b == 1: not ok213: a == 2, b == 2: ok231: a == 2, b == 0: not ok312: a == 2, b == 2: ok321: a == 2, b == 1: not ok
Quote:Because OOP was developed to minimise the potential failures that such a linear structure can have.
Quote:Original post by DrPizzaQuote:The underlying implementation may be, but the end user usage is somewhat more abstract.
No it isn't.
Quote:Original post by DrPizzaQuote:The methodologies are quite distinct.
No they aren't.
Quote:Original post by DrPizzaQuote:The most common langauge, C++, enforces no such restrictions [on how operations are organised].
It certainly does. It has destructive assignments; this means it must have restrictions on the organization of operations. We see this in, for example:int a = 0, b = 1;a = 2; // 1b = a; // 2a = b; // 3
These operations *must* be performed in an order that gives the right results:
When you have destructive assignment you are not free to arbitrarily reorder.
Quote:Original post by DrPizzaQuote:Because OOP was developed to minimise the potential failures that such a linear structure can have.
But it doesn't remove those "potential failures". It's not clear that it even reduces them.
Quote:Yes they are.
// "OO"fstream myfstream("path/to/file", ios_base::in | ios_base::out | ios_base::binary);myfstream.write(arr, arrSize);myfstream.close();
// "non-OO"FILE* myfilestar = fopen("path/to/file", "rb+");fwrite(arr, 1, arrSize, myfilestar);fclose(myfilestar);
Quote:Order isn't the be all and end all or organisation. Assignment is a special case: always a method, but other operations can usually be factored any way the programmer would like.
Quote:As said, it minimises these failures.
Quote:Constructors and destructors are a blessing, and have made many a design feasable in C++.