OO vs. Procedural Programming
After doing OOP for so many years, I've come to realize that programs are shorter, easier, and simpler to write without it. You don't need classes for basically anything. Take a look at VB, it does everything without classes (except COM) using types and handles.
Quote for horstmann.com:
Code:
C
printf("%10.2f", x);
C++
cout << setw(10) << setprecision(2) << showpoint << x;
Java
java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++)
System.out.print(' ');
System.out.print(s);
What are your thoughts on OOP? For the majority of all programming, is it truly neccesary?
Re: OO vs. Procedural Programming
Quote:
Originally posted by Speedy5
Take a look at VB, it does everything without classes (except COM) using types and handles.
Nope, VB can do everything except COM without classes, or it can use classes extensively. Essentially the same choice as you have with C++ (except C++ does classes better).
Quote:
Code:
C
printf("%10.2f", x);
%10.2f is essentially another language to learn in addition to C.
Quote:
Code:
C++
cout << setw(10) << setprecision(2) << showpoint << x;
The first time you see this you are likely to guess that setprecision(2) sets some sort of precistion to 2, and that showpoint means that points are, em, shown.
setw(10) is easy to remember once you learn also.
Hardly a conclusive defense of C++'s streams over C's but there are some ways in which C++'s is simpler.
Really, OO owns for large complex projects. Getting to know and love OO from those projects may lead you to use it for smaller projects also, but procedural will do fine.