oop

What is a "field"? "Field" vs "Field Value"

In a passport there is a field: First Name, and that field has a value John. I assert that it is correct to describe the relationship as follows: Field First Name: Has a name (First Name). Has a set of valid values (e.g. defined by regex [A-Za-z. ]{1,30} Has a description (name that stands first in the person's full name) And Pas...

What is real object-oriented (ROO) ?

I recently heard a lot about ROO for "Real object-oriented". What is all that about ? Where does it come from ? Thx ...

Which declaration is better?

Hello, I'm going to change my C# style in programming(I've been using 'public static' for variables,methods - everything). My question: public class WinSock { public Socket sock; public byte[] data; ..... } var data = new byte[2058]; data = WinSock.data; or this one: private class WinSock { private Socket sock; ...

How to decide between C# static and non-static methods?

[Edit] My original-question was "Why to decide between static and non-static? Both do the same..." Unfortunately it was edited to a C#-specific question what I really wanted to avoid. So, let me do some additions: When I say interface, I don't mean the C#-keyword-interface but what I understand something like a C++-interface: A set o...

Where do I instantiate my Objects in CRUD n-Tiered WinForm App?

Say I have a WinForm CRUD(like) application. I want to follow best practices on this so I try and make it follow OOP and a n-Tiered design. Unfortunately I am familar with the words but not the practice of them. So lets go with the following example: My CaseNote program. I have a tabbed application where you go to the search tab t...

Should I incorporate list of fees/discounts into an order class or have them be itemlines

I have no other developers to ask for advice or "what do you think - I'm thinking this" so please, if you have time, have a read and let me know what you think. It's easier to show than describe, but the app is essentially like a point of sale app with 3 major parts: Items, OrderItems and the Order. The item class is the data as it com...

PHP ignoring __set method inside the class

I'm building a class with a number of input validations, and I've decided to place them inside a __set method (I'm not sure if this is proper form as I have limited OOP experience). This seems to work fine, throwing the proper errors when invalid values are passed from outside the class. However, if a variable is modified inside the clas...

how to implement Master details classes find function in javascript?

I have this code: function Item(id, itemType, itemData, itemCategoryId, itemRank) { this.id = id; this.itemType = itemType; this.itemData = itemData; this.itemCategoryId = itemCategoryId; this.itemRank = itemRank; } function Category(id) { this.id = id; } And i want to write a function for the Item class wh...

libraries/approaches for implementing object models in C++

Apologies if this has been asked before, I'm not quite sure of the terminology or how to ask the question. I'm wondering if there are libraries or best practices for implementing object models in C++. If I have a set of classes where instances of these classes can have relations to each other and can be accessed from each other via vari...

redefining a single ruby method on a single instance with a lambda

In Ruby, is there a way to redefine a method of a particular instance of a class using a proc? For example: class Foo def bar() return "hello" end end x = Foo.new y = Foo.new (Something like): y.method(:bar) = lambda { return "goodbye" } x.bar y.bar Producing: hello goodbye Thanks. ...

Trouble passing value array into an Object array

I am trying to pass an array of values into an array of a table object so that I can write them to the database. My database looks like this -> tblCaseNotes CaseNoteID | PersonId | etc, etc tblCaseNotesContactType rowguid | CaseNoteID | ContactTypeID tblMaintItems itemID | CategoryID The itemID from the Maint table is what is being w...

Help me understand OOD with current project

I have an extremely hard time figurering out how classes needs to communicate with eachother. In a current project I am doing, many classes have become so deeprooted that I have begun to make Singletons and static fields to get around(from what I get this is a bad idea). Its hard to express my problem and its like other programmers dont...

Generic class factory problem.

Bellow is simplified version of the code I have: public interface IControl<T> { T Value { get; } } public class BoolControl : IControl<bool> { public bool Value { get { return true; } } } public class StringControl : IControl<string> { public string Value { get { return ""; } } } public clas...

OOP vs case statement in Windows forms application

I have a s/w design question. Say I have a windows form with some elements and I have a customer object. A customer can either be business, private or corporate for example. Now, all the decisions of what is going to happen in the form will depend on the customer type. For instance, certain elements will be hidden, certain label text wi...

Object properties

Is the only way to assign $systime a value of a built-in-functions, is through a method? class Test{ private $systime; public function get_systime(){ $this->systime = time(); } } Right off i would think something like this right?: class Test{ private $systime = time(); public function get_systime(){ ...

PHP constructor executes before arguments for nested variables can be supplied.

First things first, here is a little snippet code to help explain my problem: <?php class foo { public $title; __construct{ echo "<html>\n"; echo "<head>\n"; echo "<title>".$this->title."</title>\n"; echo "</head>\n"; echo "<body>\n"; } /** * * I get $title from index....

What's the best way to store PHP class attributes ?

Duplicate of: http://stackoverflow.com/questions/546403/whats-the-best-way-to-store-class-variables-in-php For some time I've been having this discussion with a co-worker on how should you store attributes within a PHP class. So which one do you think it should be used. Something like this: Class test{ public $attr1; publ...

iphone: caching and updating xml fields

Thanks for your help. Here I have another question. I get the data through XMLParsing, now I want to store it in iphone's cache, and the XML Fields are updates every 12 hours.how can i check that XML Fields are change or not? and how can I store the data in iphone's cache memory so that evry it does not has to interact with web. Can anyb...

Switching to LINQ

I'm considering spending time learning and using LINQ to SQL but after years of best practices advising NOT to embed SQL I'm having a hard time changing paradigms. Why does it seem accepted now to embed queries in compiled code? It seems almost a step backwards to me in some ways. Has anyone had issues with fix query / compile / deploy...

What do you call it when one interface "inherits" from another?

If I have class B : A {} I say that "Class B inherited class A" or "class B derives from class A". However, if I instead have: class B : ISomeInterface {} it's wrong to say "B inherits ISomeInterface" -- the proper term is to say "B implements ISomeInterface". But, say I have interface ISomeInterface : ISomeOtherInt...