oop

Using ORM with stored procedures, a contradiction?

I've inherited a web application which strictly uses stored procedures to do its job. I like the approach of making it impossible for frontend developers to break the database, but I've been tired of writing calls to SPs with plain SQLs and wanted to have something saner. While I've been looking for a decent ORM (for Perl in this case, b...

Creating a Catch-All AppToolbox Class - Is this a Bad Practice?

Never sure where to place functions like: String PrettyPhone( String phoneNumber ) // return formatted (999) 999-9999 String EscapeInput( String inputString ) // gets rid of SQL-escapes like ' I create a Toolbox class for each application that serves as a repository for functions that don't neatly fit into another class. I've read tha...

Syntax error when in a class but not out in the open?

When I do: class MyClass { public $copy = file_get_contents('somefile.mdown'); } I get: PHP Parse error: syntax error, unexpected '(', expecting ',' or ';' \ in /file.php on line 25 I'm new to classes in PHP, but not to OOP. I can, of course, just do file_get_contents outside of the class and all is well. What's up with this? ...

Cohesion and coupling within a component

How important are coupling and cohesion within a component of an application? Here, I am talking about all those classes in a component that are not published. How important is it for them to have high cohesion and low coupling? The reason I am asking is that I used an eclipse plugin to find out the design defects for a fairly simple pr...

What's a decent events library for non-GUI applications under *nix? (C++)

First, I'm using Qt at the moment. However, I want the program eventually able to run without a GUI environment, leaving the graphical aspects for configuration mainly. The program makes hefty use of Qt timers and signals/slots, partially for QtScript. So if I want to make it non-GUI operable, hopefully parts of Qt can run without a GUI ...

Difference in compiler design for OOP languages

Hello. I'm doing a research on how the design compiler for an OOP language differs from traditional imperative languages. I'd just like some topics to send me on my way, and if you wish, you can explain them. For eg. I found that the type table is built differently. ...

PHP: Class segmentation ?

I'm building an Authentification library that's going to have around 45+ methods for dealing with user related stuff. However I've been wondering if it's actually recommendable to keep everything on a single file. Is there a benefit on splitting my class into several subclasses and load them when needed? I can always for example split ...

Best design pattern for multiple options in winforms app?

Hi, I have a winforms app which performs actions (logging into a site and performing UI tests), but with a number of selected options such as logging in via basic auth or normal forms auth, as well as the browser type, etc. Is the specification design pattern best suited to this? Are there any other good strategies? Thanks ...

What is a Value Class and what is a reference Class in C#?

What is the definition of a value class and reference class in C#? How does this differ from a value type and reference type? I ask this question because I read this in the MCTS Self-Paced Training Kit (Exam 70-536). Chapter 1, Lesson 1, Lesson review 4 : You need to create a simple class or structure that contains only value t...

How do I compare two objects based on their base class?

I would like to be able to compare two classes derived from the same abstract class in C#. The following code illustrates my problem. I now I could fix the code by making BaseClass non abstract and then return a new BaseClass object in ToBassClass(). But isn't there a more elegant and efficient solution? abstract class BaseClass { B...

Request for Creational Design/Pattern Suggestion

I have a number of classes that are all related conceptually, but some more-so at the details level than others. For example, these three classes have nearly identical properties (although member functions will vary): public class RelatedA : IRelatedType { public string Name { get; set; } public string Value { get; set; } p...

Should null == null be true when comparing objects?

I'm curious what everyone thinks. In SQL (at least in oracle) NULL translates conceptually to "I don't know the value" so NULL = NULL is false. (Maybe it actually results in a NULL which then gets cast to false or something like that...) This makes sense to me, but in most OO languages null means "no reference" so null==null should pr...

What is best approach on designing this abstract class? (Part 2)

Hi there I have abstract class called Tenant and Customer. The tenant in this case is like owner of the application for multi tenant application model. The relationship between these 2 class are Many to One relationship. public abstract class Tenant { protected Int32 id; protected String name; public Int32 ID { get; set;...

One class for one view

This may be a foolish question.but I want to know,,,, In my iPhone Application I have so many classes and Xib files (Like 12 to 15).Is it ok to have it like that???... Is there any limitation for number of classes......?????..... Does it affect the performance of the app????.... Thanks. ...

What is the difference between association and dependancy relationship?

What's the difference between Association and Dependency? Aren't they both the same thing? as if class A is associated with B then Class A is dependent on B ie. there's a dependency between A and B. ...

Comparing variables in two instances of a class.

Hello! i have what i hope is a quick question about some code i am building out.. basically i want to compare the variables amongst two instances of a class (goldfish) to see if one is inside the territory of another. they both have territory clases which in turn use a point clase made up of an x and y data-point. now i was curious to ...

Single class and Class Collection

Hi there I'm always coding referencing an object as a single class and if I want to get the collection of that class I just used the Get() and return as a list. public abstract class Customer { private Int32 customerID; private String customerName; public abstract List<Customer> Get(); public abstract bool Add(); publi...

Class Design: Serialize Within Domain Object or Helper Class

Lets say I have some domain objects that will need to be serialized/packed using a custom binary format so they can be sent over sockets to external processes. My first instinct would be to create an interface that represents any object that can be packed into this binary format. public interface IPackable { byte[] Pack(); } Then...

What is the story on $variable->something in PHP?

I've seen this used a lot, especially with SimpleXML. Is this: $row->unixtime simply the same as doing this??? $row[unixtime] What is this called, why/how should it be used? ...

AS3: How to organize code, in case remote services are called

Hi! In my flex application I use services a lot. I need them to update my data in the application, so call them quite often. Currently I implemented it in the following way: 1) There is a service provider (AMFLoader class) 2) And response handler (Responder class) The code looks like this: public function AMFLoader(url:String):void {...