473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Pit falls to OOP


I am hearing alot about how slow OOP is.
Is there ways to increase its speed? eg better programming,
techniques? I know that one cant compete against
well-writen assembly, but I am sure there there are
pit-falls to avoid with OOP.

Any suggestions? eg like avoid doing alot of sub calls?
Nov 20 '05 #1
7 959
Glenn,
I am hearing alot about how slow OOP is. Really, where you have heard that?

Are you talking coding, execution or maintenance? As I find OOP faster in
all three cases. Of course when working with people who "just don't get it"
OOP coding tends to be slower. However that is not a problem with OOP!

For example: simply OOP techniques such as replacing conditionals (If ElseIf
or Select Case) with Polymorphism may actually speed up your program...
Is there ways to increase its speed? eg better programming,
techniques? Better programming techniques apply whether you do OOP or not.

As I'm sure you are aware well written OOP will perform better then poorly
written OOP, just as well written procedural will perform better then poorly
written procedural. Or well written assembly better then poorly written
assembly.
techniques? I know that one cant compete against
well-writen assembly, but I am sure there there are
pit-falls to avoid with OOP. I don't know being able to quickly write robust programs that are easily
maintained using OOP, while it takes significantly longer to write a
well-written assembly program, seems to be a pit-fall of assembly. Having
maintained a number of assembly programs, I know they are not easy to
maintain.
Any suggestions? eg like avoid doing alot of sub calls? Most of my OOP tends to be smaller classes with smaller sub routines, so it
actually increases the number of sub calls. I have not seen any performance
problems.
The following articles provide information on writing .NET code that
performs well. (OOP or not).

http://msdn.microsoft.com/architectu...l/scalenet.asp

http://msdn.microsoft.com/library/de...anagedcode.asp

http://msdn.microsoft.com/library/de...anagedapps.asp

http://msdn.microsoft.com/library/de...vbnstrcatn.asp

http://msdn.microsoft.com/library/de...tchperfopt.asp

http://msdn.microsoft.com/library/de...tperftechs.asp

Hope this helps
Jay

"glenn" <an*******@discussions.microsoft.com> wrote in message
news:19****************************@phx.gbl...
I am hearing alot about how slow OOP is.
Is there ways to increase its speed? eg better programming,
techniques? I know that one cant compete against
well-writen assembly, but I am sure there there are
pit-falls to avoid with OOP.

Any suggestions? eg like avoid doing alot of sub calls?

Nov 20 '05 #2
* "glenn" <an*******@discussions.microsoft.com> scripsit:
I am hearing alot about how slow OOP is.
OOP is about structuring your sourceocode and make it more readable.
It's not about saving bytes in memory or doing low-level optimization in
assembler code.

So, my suggestion is: Don't care about speed to much if it would
require your code to be hard to understand.
Is there ways to increase its speed? eg better programming,
techniques? I know that one cant compete against
well-writen assembly, but I am sure there there are
pit-falls to avoid with OOP.
Sure, there are some tips and tricks depending on the situation, but I
don't know a general overview over these tricks ;-).
Any suggestions? eg like avoid doing alot of sub calls?


That's hard to say, because the JITter may inline procedure calls to
make execution faster. With .NET, you have few control about to what
MSIL your code gets compiled, and how it looks like when the JITter
converts it to native code.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #3
Glenn,
In addition to Herfried's comments, I should add to my comments:

I find it better to write "correct" programs then to worry about
performance. By "correct" I mean OO and use the correct tool for the correct
job (for example: when to use ChrW and when to use Convert.ToChar). Remember
that most programs follow the 80/20 rule (link below) that is 80% of the
execution time of your program is spent in 20% of your code. I will optimize
the 20% once that 20% has been identified & proven to be a performance
problem via profiling (see CLR Profiler in my other message).
For info on the 80/20 rule & optimizing only the 20% see Martin Fowler's
article "Yet Another Optimization Article" at
http://martinfowler.com/ieeeSoftware...timization.pdf

For a list of Martin's articles see:

http://martinfowler.com/articles.html

Hope this helps
Jay

"glenn" <an*******@discussions.microsoft.com> wrote in message
news:19****************************@phx.gbl...

I am hearing alot about how slow OOP is.
Is there ways to increase its speed? eg better programming,
techniques? I know that one cant compete against
well-writen assembly, but I am sure there there are
pit-falls to avoid with OOP.

Any suggestions? eg like avoid doing alot of sub calls?

Nov 20 '05 #4
Infact, it is much better to have a OOPs based application in a
production environment.

All our production apps are written and rewritten in OOPs based
structure, resulting in easier management of maintenance, upgrading,
and modifying.

Regards
Bharati
http://www.vkinfotek.com
Nov 20 '05 #5
Glenn,

Yes, it can slow down. As every program is, that is not good written.

One of the extra that the processor has to do is getting all the references
you have made to connect all what is needed.

You probably have never noticed that is in any program. OOOP gives you the
change to do it in a structured way.

When you are writing programs with a dotNet language, (does not matter which
one) you cannot around OOP.

However when you would use this technique on a Commandore 64 in that way it
used on a modern computer, it really would in my opinion slow your program
down.

The same fact as that riding a horse uses less fuel than riding a car.
However, you should have seen the dirt in the streets in the days that it
was common.

Just my thought,

Cor
Nov 20 '05 #6
bharathi,
I Agree, as that is what I attempted to say in my first message...

Jay

"bharathi" <pe********@yahoo.com> wrote in message
news:cc**************************@posting.google.c om...
Infact, it is much better to have a OOPs based application in a
production environment.

All our production apps are written and rewritten in OOPs based
structure, resulting in easier management of maintenance, upgrading,
and modifying.

Regards
Bharati
http://www.vkinfotek.com

Nov 20 '05 #7
On Thu, 22 Jul 2004 08:27:33 +0200, Cor Ligthert wrote:
However when you would use this technique on a Commandore 64 in that way it
used on a modern computer, it really would in my opinion slow your program
down.


The Commodore 64 was a great little computer. Mine lasted a very long time
and it could take a beating and would still work. The BASIC used was far
from what we use now, but it was still very easy to write a program
(although not OOP). I also remember entering programs from magazines by
typing in the data one byte at a time. Very tedious, but rewarding when
the final result ran.

There is an emulator for the C64 available.

Brings back memories.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: budgie | last post by:
Hi, I have a table with availability of rooms which has the htlrm_id: hotel room id avl_date: date this room is available avl_qty: quantity of this room available avl_rate: rate at which these...
0
by: styler | last post by:
I am having difficulty with the page located here: http://tinyurl.com/2zwa9 I am creating a number of image sets (some left-, some right-aligned; an example of the right-aligned is shown the...
2
by: bill | last post by:
Hi, I just spent a loooooooong day to debug a problem, it ended up that sort() does not work properly on my vector!!! In the program I have a vector and the program dynamically add some new...
2
by: Simple Simon | last post by:
Hi all, I'm struggling with an elegant way to figure out if DateTime.Now falls between any Firday @ 6pm and Sunday @ 9pm. ne1? ~Gordon
2
by: Robert Dickow | last post by:
I have some ASP.NET Web App pages on which there are web forms with textboxes and buttons for 'Cancel' and 'Submit' and such. All works great. However, it a user uses the ENTER key in either of two...
3
by: M O J O | last post by:
Hi, About every half hour, my sqlserver falls asleep. When I try to browse my homepage (uses aspnet/sqlserver), I get this error: Timeout expired. The timeout period elapsed prior to...
8
by: active | last post by:
I use quickwatch on (astrThisOne <> "") and it reports: False as it should because astrThisOne reports: "" Yet If (astrThisOne <> "") Then executes the Then clause
1
by: DeanMiller | last post by:
I was wondering if there is an easy way to check if a date falls in a given selection range. I have the selection range already made and I want to be able to take a given date and see if it falls...
13
by: citizenprice | last post by:
I have three fields in a Union Access Query (ID, Begin_Date, End_Date). I want to modify the query to include a parameter date to be entered by the user and produce a result if the parameter date...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.