₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,974 members, 8,424,379 topics. Date: Thursday, 11 June 2026 at 06:48 AM

Toggle theme

Criticism Of Object Oriented Programming - Programming (2) - Nairaland

Nairaland ForumScience/TechnologyProgrammingCriticism Of Object Oriented Programming (7144 Views)

1 2 Reply (Go Down)

Re: Criticism Of Object Oriented Programming by logica(m): 2:24pm On Dec 13, 2008
What will result is you will have a bunch of "cut-and-paste" students who have no real idea how the code works or why the syntax is different from Pascal. The point I am trying to make is, you do need to teach students of Java, OOP concepts before they start learning the language (and that is what is recommended).  I have no doubt that if you read the newbie books well, they state the target reader(s) (e.g C++ programmers, programmers with OOP understanding, etc) and they usually mention chapters that students with good understanding of OOP may skip. You have skipped a very important item in their curriculum.
Re: Criticism Of Object Oriented Programming by dammytosh: 3:20pm On Dec 13, 2008
logica:
you do need to teach students of Java, OOP concepts[b] before they start learning the language[/b] (and that is what is recommended).
@logica, that is not true. It depends on ur approach. Good Books like "Java  How To Program From Deitel Associates" apart from introducing Objects and classes briefly in chapter 3 did not go into the details until they get to Chapter 6 ,  and a lot of problems have been solved before then.

You can't teach java without teaching OOP. that is no news  smiley, nobody doubts that. The point is that u can actually be a little comfortable with it before u understand all the concepts in depth.

Try to read all my posts on OOP in this section.  I don't work on live projects without using the OOP paradigm not because it is a must, but because it is the easiest way for me to manage my project.

Lets concentrate on the Subject matter for people who are learning from the posts. Thanks
Re: Criticism Of Object Oriented Programming by Nobody: 12:17pm On Jan 01, 2009
@poster,

while procedural programming is not bad, OOP can be very helpfull when you have to handle complex applications

and saying python is not object oriented is wrong, since it support classes and objects
Re: Criticism Of Object Oriented Programming by Seun(mod): 8:38pm On Jan 01, 2009
I think I had some of my terminologies mixed up. What I meant to say is that unlike languages like Java, Python does not force you to program using OOP constructs if you don't feel like using them.

My real problem is with programmers using unnecessary OOP constructs for problems that would be best solved with a procedural or functional approach. I just want you to know that there's life outside OOP!
Re: Criticism Of Object Oriented Programming by Nobody: 1:48pm On Jan 02, 2009
thats true, i know a guy who falls into that category,

writing classes for a demo.
Re: Criticism Of Object Oriented Programming by Nobody: 12:19pm On Jan 04, 2009
@Seun is quite right about that - for instance javascript is NOT object oriented - but makes use of objects - and u can create classes as well.
Class creation in javascript is not compulsory to use classes, but some languages like c, java will tell you that any program you write
even if it is a beginners program must start by declaring your class - whether you now create other classes after that one is now your own business.

But me i love creating classes in javascript and php - they sure lessen my work. For instance, ever since i started using ajax, i created a base class that performs all the routine ajax stuffs i need, and the class comes with even handlers and stuffs, so anytime i am writing a new ajax script, i just inherit directly from the base class - that way any new solution i create based on ajax - i will not start writing onreadystatechange=,
i can just declare that:

var page=new jpage();
jpage.ondownloadcomplete=function() {alert(jpage.responseText);}
jpage.download("http://www.nairaland.com/");


And that is it - instead of having to start writing all those long ajax codes,  generally classes can aid your work and make you obtain faster results
But then, procedural vs oop: the important thing is to get your results as fast as possible - getting the job done that is.

I understand there is more to programming than using OOP constructs - just that if classes are used - and you are able to tap into their features like polymorphism, inheritance, reusability, it will make your work easier - and you will get results faster.
Plus if u find a bug later in future in the class - just sort it out in the present project - then reupdate the class in previous projects - that way you can keep your codes better organized - i use classes mainly because of that - anytime i find a new function somewhere online - i just integrate them with my base classes - that way it is saved for a rainy day.
Re: Criticism Of Object Oriented Programming by Nobody: 2:32pm On Jan 04, 2009
even the ajax u talk about, with me, no classes

just a function mapped out so well that i just need to call ajaxify(<page_to_request_from_server>,<var_to_be_sent>,<final_location_of_response>)
Re: Criticism Of Object Oriented Programming by prodgalson: 8:36pm On Jan 04, 2009
Been ages since I've been on NL. Nice one with the informed discussion. Dont have anything to add.
Re: Criticism Of Object Oriented Programming by Nobody: 4:39am On Jan 05, 2009
And my site is entirely ajax driven too - www.mwebng.net - makes it very easy to update - because the entire site is just like an object built on an ajax framework - anyway - i have been posting some ajax related and class threads in the webmasters section - the moderator even pinned many of my threads on the first page of the webmasters section - Tutorials In Webmasters Section - https://www.nairaland.com/nigeria/topic-214594.0.html
And they are complete with samples and downloadables where necessary. The idea is that if classes are used very well your codes will become minimal.

Most of my personal ajax classes for instance can be used to download something as shown below:


<script src="jpage.class.js"></script>
<script>
var page1=new jpager();
page1.onDownloadSuccess=function() {document.body.innerHTML=page1.responseText();}
page1.onDownloadFail=function() {alert("Your download was not successful"wink;}
page1.download("Home.html"wink;
</script>


That in ordinary codes will mean:

<script>
function ajaxRequest() {
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
for (var i=0; i<activexmodes.length; i++){try{return new ActiveXObject(activexmodes[i])} catch(e){alert("Failed"wink;}}
} else if (window.XMLHttpRequest) {return new XMLHttpRequest()} else {return false}
return;
}

function download(url) {
var mygetrequest=new ajaxRequest()

mygetrequest.onreadystatechange=function(){
if (mygetrequest.readyState==4){
if (mygetrequest.status==200) {document.body.innerHTML=mygetrequest.responseText;}
else {alert("Download was not successful"wink;}
}
}
mygetrequest.open("POST", url, true);
mygetrequest.send(null);
}

download("Home.html"wink;
</script>


You can easily see which one is more productive - using classes - you can keep your baseline functions and stuffs into
it - that way mistakes will be minimal. If i am using my classes to do work and they fail - i know it is a code in the specific
project and not an error in my class - talking about functions in my various classes that i have used in more than 1 project.

And again, all my ajax classes are derived from my own version of prototype which contains various useful codes
i copied from so many places. But unlike the regular prototype class where they just dumped uncountable
codes making the entire class so large though functional, mine is splitted into bits and pieces, so i just
need to pick the ones i need for a particular project, that way my pages load faster.
Re: Criticism Of Object Oriented Programming by Nobody: 4:47am On Jan 05, 2009
Another common class i also use in php - now this one is a big one - it is a mailer class.
It can send alot of emails at once - i only use them on enterprise sites whenever the admin needs to
send notification to clients.

<?php
include_once "blah-blah-blah.class.php";
$mailer=new SendMail();
$mailer->send("wale@32.com","bc","cc","subject","message"wink;
?>

The question is why not just use the mail function - well - this will convert the mail to the correct mine
format [and encodes it exactly the way yahoo encodes emails] - so that it can send properly formatted
html messages and can add unlimited number of attachments to it.
And if the to field contains more than 1 email address, then it will send the message to each person individually
and not just dump all of them into one long to field.

I did not want to discuss this here - as some may relate it to spamming [and God help anyone that tries to contact me for a mailer]
but hese are tools used by webmasters and of course there are lots of free mailers online - just type your search into google.

I was just trying to explain how classes can solve a lot of problems and make you code more efficiently.

So, if you work with objects like this, it makes your overral efficiency better, you can easily focus on more pressing issues
than to start debugging one small code here and there - debugging ajax, debugging php, my mail is not being sent,
Re: Criticism Of Object Oriented Programming by Nobody: 10:50am On Jan 05, 2009
can i have ur mailer class? Just brother to brother na grin
Re: Criticism Of Object Oriented Programming by Nobody: 3:16pm On Jan 05, 2009
Well, i am sorry, i dont give mailers out, just go to phpclasses.org - i am sure you will find a better one - afterall i am just an amateur!
Re: Criticism Of Object Oriented Programming by Nobody: 7:45am On Jan 11, 2009
And to now clear this up, facebook application development. Instead of facebook to start telling developers that this is the database where , is stored, they just provided us with the framework we need - they provided us with a client-sided class [javascript/json] and a server sided php class to do all our manipulations. I created a thread on how to build facebook classes on https://www.nairaland.com/nigeria?topic=214623.0 - all these show that OOP solves alot of problems.

Google too are supplying us with free ajax classes that enable us to pull rss feeds into our websites via ajax and u can use those classes with the instructions even if you do not know what the A in Ajax stand for.
I made a tutorial on this google class on https://www.nairaland.com/nigeria/topic-216105.0.html

I stand to be corrected, using Object Oriented Programming is a very professional way of working.

If you are still not convinced, you can check out some of the web developer's objects i have on my website - www.mwebng.net
Many of those things [still need to be reviewed] do not require you to know so much before you can use them.

Once you follow the instructions and get the right steps u will be able to use them - instead of saying, go into my source code on line 12, change this to the name of your box, go to the ,
Re: Criticism Of Object Oriented Programming by martkun: 2:05am On Nov 10, 2010
I just saw this old topic and I wanted to say my opinion.

@Seun - I completely agree with you

Object oriented programming is suitable for some tasks but not for all tasks. There's no point of using only object-oriented code - both procedural and object oriented styles have their pros and flaws so the style that suits better for the current task should be used. There is also nothing wrong with mixing the two styles.

I don't like the object oriented programming in neither Java nor C++. The object oriented capabilities of Python are designed much better (in my opinion). I also have no problem writing pure procedural code - my favorite language is C.
Re: Criticism Of Object Oriented Programming by Nobody: 8:43am On Nov 10, 2010
to some point yes Procedural can be used if the Projects has noPotential of becoming a big project or flexible but to be frank OOP is much more saner and easier to adapt to, it easy for me to think about the each Component as classes and create each modules, reason being is incase another projects emerges it should be in a way that it can be added to another project and it will easily run, like take PDO Database for example Procedural has lots of headaches tracing bugs in procedural requires you to trace the process rather than the Object.Java Programming Style is the best OOP is best and Organizations know that Projects will always have newer version with OOP its easier to extend Projects without affecting original source code, with OOP creating API makes your job far sane and easier, infact there are some times OOP best suits some work, imagine i wanted to send mails to people which belong to a certain class or a certain role in procedural i will be forced to check their role but with OOP i will just create a single iteration function with an "instanceof" check and thats all,plus Debugging in OOP is far more Saner i use aptana at times i always lose track and debugging in Aptana lets you watch the whole process i can which class was instantiated and the type of exception it threw,i was forced to learn OOP when i started learning c++ and java and also when my work become so Spaghetti Code like.Embrace OOP plus you must be kidding you don't like C++/Java style i guess you must be comfortable rolling out an application in C,go and learn Qt for C++ and se how less u code and how much create,even the jquery framework has OOP because for you to chain objects in jquery you must create a prototype for each object,most CMS use OOP, even the SMF we are arguing this debate on prob has upgraded to OOP, so whats gives,am still shocked and disappointed that seun will create a thread like this,
Re: Criticism Of Object Oriented Programming by Nobody: 8:45am On Nov 10, 2010
actually sorry but Javascript is OOP but fully OOP it has inheritance, and can call parent function
Re: Criticism Of Object Oriented Programming by Ghenghis(m): 5:15pm On Nov 11, 2010
dead thread has resurrected ,

2 very important attributes of OO are : inheritance & encapsulation.

If you think in these terms, its always better to use an OO style rather than procedural approach. Personally, i hate dirty code. I don't like seeing a programmers implementation details ( Many don't know when to use private. protected etc.).

If you add this to the modern IDEs, its always a pleasure programming OO rather than the monolithic style of procedural.

Look at the kind of possibilities with javascript libraries like Jquery, OO has put javascript on steroids. Its not as if javascript hasn't always been powerful, but harnessing and controlling this power has been beyond most programmers. OO helps manage the complexity ,

I have to admit that there are areas of programming where OO is not necessarily the best fit, like functional programming but most apps can benefit from an OO strategy. A solid example of OO with some functional style programming is the hibernate library, sweet , cheesy
1 2 Reply

A Beginners Guide To Object-oriented Programming (OOP) In PHP 5+Fundamentals Of All Object Oriented Programming(oop) LanguagesPlease What Really Is Object Oriented Programming.234

...For Those Willing To Be Data Analyst, Machine Learning GuruEarly to Early-mid career VoIP Professional