oop

Instance giving a Object Reference error

Hi there, I've written a new DAL and BLL, but when I try to create an instance of my class, I get an Object Reference error, is there anything particular I should be looking for? I am fairly new to this concept? Call is such: Protected Sub btnSignin_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles bt...

Looking for a Design Pattern

I have 80-90 classes which are all a type of calculation. But each class uses one method compute which is the same in each in class. The items that are different in each class are the are the instance variables used inside the compute method. The reason I am looking for a pattern is because what I am doing seems extremely repetitive.Be...

Drupal development and use by professional programmers .. are there specific pitfalls or advantages?

Background: Long ago Microsoft Access gained a lot of popularity because you could build pretty powerful desktop database applications with point-and-click ease. It seems like Drupal is now doing the same thing, except for the web. This is definitely good in some aspects, but it seems to have some drawbacks as well. From the perspective...

Database and OOP Practices in PHP

Its difficult to explain this situation but please see the example. I have coded a website where the page loads, I initialize a database class. I sent this class as a function parameter to any functions that needs to access database. I know this is bad approach but currently I have no clue how to do this any other way. Can you please ...

How can I manage a group of derived but otherwise Unrelated Classes.

It seems the more I talk about this problem the better I understand it. I think my previous question didn't convey what I am trying to do correctly. My apologies for that. In my design I have GameObjects which are essentially an aggregation class, all functionality in a GameObject is implemented by adding various "Features" to it. A Fea...

Elegant design of simulating a read-only object

Hi, I am currently developing an GUI to an embedded system. (I am using GUI to descripe my app opposed to interface to avoid confusion with the progamatic meaning) Context I have created a class which simulates the embedded system. I do all my communications through a Connection class I have designed which can communicate via TCP/Seria...

Ruby: OOP & two-dim array question

I need to create a two-dimensional array Class. I've done a work, but discovered that my class simply has an inner two-dim array, and to access the elements I have to write a redundant word 'table': class Table attr_accessor :table def initialize(w,h) @table = Array.new(h) h.times do @table << Array.new(w) end end x = Ta...

Object being passed to Function, but not being received... why?

I'm not having any errors from these pieces of code, they're just empty everytime. I'm wondering if I perhaps have created them incorrectly. Help as always, hugely appreciated; Dim l As New Log() l.Log = "Attempted staff login with username [" & txtUsername.Text & "]" l.LogId = 0 l.StaffId = 4 l.LogDate = Date.Now() l.Insert() .Inser...

Access Outer Class this instance

how do we access outer class this instance: eg in Class A { Class B { this.helloB(); (A's this).hello() } } how do we access A's this instance in Java ...

creating a wrapper around a 3rd party assembly - swap out and decouple

I have an email component that I am integrating into my application, looking for some tips on how should build a wrapper around it so I can swap it out with another 3rd party component if needed. My approach right now is it: build an interface will the functionality I need. create a class that implements the interface, using my 3rd pa...

intermediate in javascript looking for a book to learning object oriented programming

I am an intermediate javaScript programmer, and i am interested in expanding my knowledge in object oriented programming (especially object oriented JavaScript). I would prefer a book over browsing scattered web resources, does anyone have an idea of which book will be best to get a head start with? Thanks ...

Object-oriented design: Saving complex objects

I have a complex domain model built on top of a legacy system that I've built most of the "get" methods for - typically just by passing around database primary key IDs. Easy enough. I'm now curious how to approach the task of creating new objects in the database and saving existing ones with new data and want to make sure I cover all my ...

Security and roles authorization with model view presenter design pattern

Where is the most fitting place for security and roles authorization to fit into the model view presenter design pattern? Would it be for all pages that implement security to implement a specific interface, say IAuthorizedView that's along the lines of public interface IAuthorizedView : IView { IUser user; void AuthorizationIn...

How to compare two distinctly different objects with similar properties

This is all in C#, using .NET 2.0. I have two lists of objects. They are not related objects, but they do have certain things in common that can be compared such as a Guid based unique identifer. These two lists need be filtered by another list which just contains Guid's which may or may not match up with the ID's contained in the firs...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I'd like to serialize this to JSON and send it to (for example) a JavaScript page, which would convert the JSON string back into objects. But it should then...

combining decorator and state pattern in java - question about OO design

I am in the middle of solving a problem where I think it's best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set amount of ingredients and a few different types of sadnwiches i can make. Each ingedient has a cost associated with it. The client would be...

While designing ORM, what is the best approach to represent relationship, performance-wise ?

While designing ORM, what is the best approach to represent the relationship, performance-wise? I mean, out of the following two, which approach is best considering performance? class Employee { int ID { get; set; } String Name { get; set; } int DepartmentID { get; set; } //This approach uses DepartmentID } --- OR ---...

Making transient (non-database) attributes in Django model available to template.

One of my models has attributes that are not stored in the database. Everything is fine at the view and model level but I cannot seem to display these 'non-database' attributes in my template. Here's some example code, an artificial example that mirrors the actual problem domain, to demonstrate the undesired behavior. The view: def o...

Template Classes in C++ ... a required skill set?

I'm new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly? ...

Does using callbacks in C++ increase coupling?

Q1. Why are callback functions used? Q2. Are callbacks evil? Fun for those who know, for others a nightmare. Q3. Any alternative to callback? ...