oop

which has better performance? static versus objects

I have designed a C# console application to merge and split huge files (about 4GB of size) using OOP design. It involves reading/writing xml, flat-files, and images. I have classes for readers and writers. The merging took about 00:12, while the splitting took more than 04:30 hours. Then I've enhanced the performance of the splitting t...

Is Java 100% object oriented?

Java has primitive data types which doesn't derive from object like in Ruby. So can we consider Java as a 100% object oriented language? Another question: Why doesn't Java design primitive data types the object way? ...

Customer class associated with multiple entities

So I have an application thats main purpose is to manage customers. My issue is that I'm not sure how to tie everything related to the customer together? For the sake of this post, let's pretend that a customer can have an unlimited number of emails. Below is what I was envisioning: class Customer { private int id; ...

How far can you go using subclassing in objective-c?

In an iPhone app, I need to customize the look of a UINavigationController class. For instance, make the bar and font size bigger. My client really needs that, and bigger buttons aswell. So, instead of writing the class from scratch, I decided to subclass UINavigationController. My question is, can I customize any method or attribute's ...

Class properties concerning List<T> requests – Class design dilema!

When I need to grab more than one record from table(database), my method populates List of particular class (all of my data access layer methods use List for set based select statements. I Don't use datatable/dataset or xmlDocument approach). So lets suppose next simplified scenario; I have two classes – customer and order with these fie...

self-reference within declaration of a structured javascript variable

Suppose I declare a structured Javascript variable like this: var mydata = {'list':[ {'fname':'george','lname':'washington'} ,{'fname':'oscar','lname':'wilde'} ,{'fname':'james','lname':'polk'} ] ,'summary':this.list[1]['lname'] } Question: How can I ensure that this.list[1]['lname'] equals 'wilde' and that my "this" is actually re...

What do you think of MooseX::Declare?

I've stumbled upon the MooseX::Declare documentation, and I have to say "WOW!". That looks really nice! I think it's the cleanest OOP syntax Perl has. use MooseX::Declare; class BankAccount { has 'balance' => ( isa => 'Num', is => 'rw', default => 0 ); method deposit (Num $amount) { $self->balance( $self->balance + $a...

oo question - mixing controller logic and business logic

I'm not sure if I'm using "standard" terms, but this is a basic OO question I'm trying to resolve. I'm coding a windows form. I don't want logic in the form event handler, so I just make a call to a custom object from there. At the custom object, there are two sets of logic. The "controller" logic, which decides what needs to get ...

Should I learn Perl 5 OO or Moose first?

I'm still relatively new to Perl Programming, but I know how Perl 5 OO basically works. However, I have never created any project with Perl 5 OO, so I'm quite sure I will run into many pitfalls. Recently I discovered the hype about the Moose module. I checked out some documentation on CPAN and I found it to be quite interesting and help...

Replacement language for C++?

When working on hobby projects I really like to program in low-level languages (in the sense that C and C++ are low level). I don't want to work with managed languages with garbage collection and whatnot that takes all the fun away (yeah, we're all different ;-) ). Normally I use C++ for these type of projects. C++ is rather complex and...

Programming to Interfaces, how generic is too generic?

How far back up the implementation hierarchy do I want to go when returning an object? Using the Java collection interface as an example, would this be appropriate? Collection outerMethod() { return innerMethod(); } List innerMethod() { List list = new ArrayList(); //do something with the list that requires a method in the...

Are tag (or "marker") interfaces obsolete?

I'm trying to help a coworker come to terms with OO, and I'm finding that for some cases, it's hard to find solid real-world examples for the concept of a tag (or marker) interface. (An interface that contains no methods; it is used as a tag or marker or label only). While it really shouldn't matter for the sakes of our discussions, we'...

Correct way to lay out Interface C#

Hello all, I'm having a problem designing part of my program (not writing it, for once!). This is kind of hard to explain without writing a novel, so I'll try and be brief. Basically, I have a program which reads/writes parameters from a piece of hardware. Currently, it does so over Serial, but eventually, I'll like it to do so over U...

Alternative to the visitor pattern?

I am looking for an alternative to the visitor pattern. Let me just focus on a couple of pertinent aspects of the pattern, while skipping over unimportant details. I'll use a Shape example (sorry!): You have a hierarchy of objects that implement the IShape interface You have a number of global operations that are to be performed on all...

C# design for an object where some properties are expensive: excuse to make it mutable?

Yes, I know, yet another question about mutable objects. See this for general background and this for the closest analogue to my question. (though it has some C++ specific overtones that don't apply here) Let's assume that the following pseudo code represents the best interface design. That is, it's the clearest expression of the busin...

Where do I read about the "Value Pattern" and other typical "low level" design patterns?

The Gang of Four, Uncle Bob, Extreme Programming and Alt.net are great for high level enterprise level programming methodologies. However, I find they refer to these "primitive" design patterns for which I need a learning source. Where would I read about these primitive software engineering concepts? For example, a "Value Pattern" wou...

Actionscript: Using Events vs passing self to Object - which is faster, better?

My Friend and I have this debate about it is faster in AS3 to pass this to another object to be able to have communication/interaction between the two or if Events are the way to go. While using Events to accomplish this task is pretty standard, here is some dummy code to illustrate the question: public class ClassA{ public var i...

Template Method and Strategy design patterns

This is probably a newbie question since I'm new to design patterns but I was looking at the Template Method and Strategy DP's and they seem very similar. I can read the definitions, examine the UML's and check out code examples but to me it seem like the Strategy pattern is just using the Template Method pattern but you just happen to ...

Handling graphics in OOP style

Hi In an object-oriented programming style does how does one tend to handle graphics? Should each object contain its own graphics information? How does that information get displayed? My experience with making graphical programs is limited, but I have tended to have the objects and the graphics be only loosely related. For instance, i...

Passing unnamed classes through functions

How do I pass this instance as a parameter into a function? class { public: void foo(); } bar; Do I have to name the class? It is copyable since I haven't made the class's copy ctor private. So how is it possible if at all? ...