Make your own free website on Tripod.com

OOPS IN C++



THIS PAGE IS NOT A TUTORIAL OR INTRODUCTION TO THE ABOVE SUBJECT.THIS TRIES TO GUIDE YOU TOWARDS EFFICIENT PROGRAMMING PRACTICES AND HELPS U TO REALISE THE MOST PROMINENT MISCONCEPTIONS IN THIS FIELD.

I ASSUME THAT THE READERS HAVE REASONABLE PROGRAMMING EXPERIENCE AND KNOW THE GENERAL MEANING OF TERMS USED IN ASSOCIATION WITH C++.

USING CIN & COUT WON'T MAKE THE PROGRAM OBJECT ORIENTED. FOR PROGRAMMING IN OOPS , YOU SHOULD THINK IN A WAY COMPLETELY DIFFERENT FROM PROCEDURAL ONE .THE ABILITY TO VISUALISE THE PROBLEM AS A SET OF MUTUALLY INTERACTING OBJECTS IS CRUCIAL . IT IS A TASTE ACQUIRED BY PRACTICE .

THE BREAKUP OF A PROBLEM INTO STRUCTS IS MUCH DIFFERENT FROM BREAKUP INTO CLASSES .U CANNOT CREATE AN OO SOLUTION FROM A PROCEDURAL SOLUTION BY REPLACING STRUCT WITH CLASS .FOR EG : A LINKED LIST IMPLEMENTATION IN PROCEDURAL MODEL REQUIRES ONE STRUCT - NODE - WHEREAS OO SOLUTION REQUIRES TWO CLASSES , NODE AND LIST

THE MOST STRIKING FEATURE ACHIEVED BY OO PARADIGM IS MODULARISATION . IMPLEMENTATION AND APPLICATION ARE LOGISTICALLY SEPARATED . FOR INSTANCE , A BINARY TREE / LINKED LIST IS CREATED BY ONE WITH A WELL DEFINED SET OF INTERFACING FUNCTIONS , AND FURTHER APPLICATION DEVELOPMENT CAN BE CARRIED OUT BY ANOTHER ONE REGARDLESS OF UNDERLYING IMPLEMENTATION.

DATA ENCAPSULATION IS DIFFERENT FROM DATA PROTECTION . THE FORMER ONE MEANS RESTRICTING THE IMPLEMENTATION DETAILS OF A PARTICULAR DATA ABSTRACTION FROM THE APPLICATION PROGRAMMER , BUT THE LATTER MEANS HIDING OF DATA , OR INFORMATION FROM EXTERNAL PEOPLE. PROTECTION IS FOR THE SAKE OF SECURITY WHEREAS ENCAPSULATION IS AIMED AT PREVENTING A HONEST PROGRAMMER FROM MAKING ACCIDENTAL MISTAKES.

DECLARING A FRIEND CLASS OR FUNCTION IS NOT AN ENROACHMENT OF PRIVACY RESTRICTIONS.THE POWER OF DECLARING SO LIES WITH THE CODER OF THE CLASS .HE/SHE SHOULD FORSEE THE NEEDS AND MAKE THE NESCESSARY DELARATIONS. IF YOU HAVE A LOT OF FRIEND CONNECTIONS IN YOUR CODE ,YOUR INITIAL BREAKUP OR SPLITTING IS NOT EFFICIENT AND AN ALTERNATE MODE SHOULD BE DEVISED .

INTERFACING FUNCTIONS WITH A CLASS SHOULD BE WELL THOUGHT OFF . IT SHOULD BE MINIMAL AND SHOULD PROVIDE ALL DESIRED FUNCTIONALITIES . BADLY DEVISED FUNCTIONS CAN DEPRIVE YOU OF ALL BENEFICIARY FACTORS FROM U'R CODE.IF YOU PUT TWO FUNCTIONS - GETDATA & PUTDATA , WITH OBVIOUS MEANINGS - ALONG WITH THE FUNCTIONS , YOUR IMPLEMENTATION CAN TURN OUT TO BE PROCEDURAL ... THINK WHY ?

TEMPLATES IS A FEATURE WHICH ADDS CONSIDERABLE POWER TO C++ . IT IS THIS FEATURE WHICH STILL ALLOWS THE LANGUAGE TO STAY HEAD TO HEAD WITH JAVA.IT ALLOWS YOU TO MAKE GENERIC CODES , AND SAVES YOUR VALUABLE TIME BY ALLOWING MAXIMUM REUSE .

APPLICATION PROGRAMMERS SHOULD LEARN TO USE STANDARD TEMPLATE LIBRARY . IT HAS POWERFUL GENERAL IMPLEMENTATIONS FOR ALMOST ALL OF THE IMPORTANT DATA STRUCTURES.REMEMBER THE SAYING - "NEVER RE-INVENT THE WHEEL"

RATHER THAN LEARNING THE OBSCURE FEATURES OF C++ , YOU SHOULD FOCUS ON SOLVING THE PROBLEM IN AN OBJECT ORIENTED WAY .

THE BOOK WHICH I RECOMMEND FOR THIS SUBJECT IS "OBJECT ORIENTED PROGRAMMING IN ANSI C++ " BY MICHAEL SMITH . ALSO VISIT www.cuj.comTO GET IN TOUCH WITH LATEST DEVELOPMENTS IN THIS FIELD .





Free Hit Counter