oop

How do I access form properties with Invoke, but with object parameter in C#?

Hello, I couldn't describe the title of my question the best,I'm sorry. Currently,I use Invoke to access the properties on my form,It works perfect,but I have a function for each property,which is quite not comfortable. public static void EnableLogin(int enabled) { var form = Form.ActiveForm as FormMain; if (for...

Protected class structure in Java?

Hi, I was wondering if there's a language feature in Java in which methods of a superclass would be invisible for members of a subclass: public class Subclass extends protected Superclass or something. I'll give an example. Here is your superclass. public class A{ public String getA(){...} public String getB(){...} publ...

$this->a->b->c->d calling methods from a superclass in php

Hello i want to make something on classes i want to do a super class which one is my all class is extended on it ____ database class / chesterx _/______ member class \ \_____ another class i want to call the method that is in the database class like this $this->database->smtelse(); ...

difference between abstraction and encapsulation?

What is the precise difference between encapsulation and abstraction? ...

Do you consider it bad form in PHP to access super globals within class methods?

Take an example login() function within a class Account. class Account { /* Class variables */ public function login() { if(isset($_POST['username']) else if(isset($_SESSION['accountId'])) return $this->_sessionLogin(); else if(isset($_COOKIE['username']) else return false; } ...

For each function in class within python

In python is it possible to run each function inside a class? EDIT: What i am trying to do is call of the functions inside a class, collect their return variables and work with that. ...

DDD aggregates vs GoF's facade

Other than implementation details, are DDD aggregates similar to GoF's facade ? ...

How to refactor a class in C++ to make a certain function const?

I have a class which looks something like this: class MyClass { public: // some stuff omitted /*** A function which, in itself, is constant and doesn't change the class ***/ void myFunction( void ) const; private: /*** If loaded is true, then internal resources are loaded ***/ boolean loaded; }; Because I desig...

What is the correct way to model an object which provides many services ?

Basically I have an entity (called Session) which will provide many different Services. Each service can be selectively turned ON or OFF by the user (signin or signout). I am not sure what's the best design to represent this. See UML From a programming use case perspective, the interactions with a Session instance: Session session = ne...

Modify C# Class method during execution

I'd like to override a class method without inheriting the base class because it'd take a lot of time and modifications and, therefore, more and more tests. It's like this: class TestClass{ public void initialMethod(){ ... } } And somewhere on the code, I'd like to do something like this: public testMethod() { ret...

jquery plugin that does not share its config between instances

I am working with a jquery plugin that looks like this: (function($){ var options; $.fn.main(opts){ options = opts; //rest of code } $.fn.otherFunc(){ //does something with options } }(jQuery)); The problem here is that if i use this plugin 5 times on the page, the options variable gets overwritten, ...

.NET Object Hierarchy - To Event or not to Event

Your job is to design a Project Plan class library which supports the tracking of tasks (similar to how MS Project works). This class library has a Task object (among others). The Task object has a EstimatedHours (Double), StartDate (DateTime), and EndDate (DateTime) properties, among others. A Task object can have one parent Task, and...

Why would I ever use a Chain of Responsibility over a Decorator?

I'm just reading up on the Chain of Responsibility pattern and I'm having trouble imagining a scenario when I would prefer its use over that of decorator. What do you think? Does CoR have a niche use? ...

Is this a design pattern?

All over our codebase we have this repeated pattern where there's an interface with one method. Is this a real design pattern? If so what is it and what would the benefits be? Here are a few examples: public interface IRunnable { void Run(); } public interface IAction { void Perform(); } ...

How to know if an object is dynamic in AS3

In Action Script 3, you can write a class that defines a dynamic object (MovieClip and Object are two examples), this objects can be modified in run-time. What I want to know if is there some way (in run-time, of course) to know if certain object is dynamic or not. PS: Without making something like this: function isDynamic(object) { ...

Is what seems like polymorphism in PHP really polymorphism?

Trying to figure out whether PHP supports features like method overloading, inheritance, and polymorphism, I found out: it does not support method overloading it does support inheritance but I am unsure about polymorphism. I found this Googling the Internet: I should note that in PHP the polymorphism isn't quite the way it sh...

How do you arrange source code elements in C# 3.0?

Does following look good? Edit: Options are general in nature, may not be exhaustive in terms of C# elements. Single Source file can contain following: Notes: Files can come in pair - Editable + Generated Single file can have only one name-space. File: Option-1 One partial or full class per file Zero or more enum per file Zero or ...

implementing interfaces after the fact

I think, the following can't be done in Java. But I would be happy to learn how to implement something that resembles it. Suppose we have a class C, that is already used in compiled code. (We can neither change that code nor the original definition of C). Suppose further there is interesting code that could be re-used, if only C would ...

Why aren't rails helpers more object-oriented?

For example, why are the date helpers written like this: time_ago_in_words(@from_time) Instead of like this: @from_time.time_ago_in_words Is this a clear design error / inconsistency? Or is there some reason for this? ...

Another OOP Question in Asp.net

Hi, now i'm hoping the following is possible although I'm not entirely certain it is so here goes... Below is the setup of what I'm hoping is possible (in VB.net, feel free to answer in C# and I should be able to work it out): Public Class A Private _name As String Private _s As SearchA Public Property Name() As String ...