I would like some feedback on my first Python script that makes use of OOP style. This is a Munin plugin that graphs average fan speed or average chassis temp depending on the name of the plugin (dell_fans, dell_temps).
An hour or so ago I submitted a procedural version of the fan speed plugin to stackoverflow to get help converting it ...
The same question in code:
class Foo {
int getIntProperty () { ... }
CustomObject getObjectProperty () { ... }
void setIntProperty (int i) { ... }
void setObjectProperty (CustomObject obj) { ... }
//any other methods with default access level
}
VS
class Foo {
public int getIntProperty () { ... }
publi...
This is a sort of design question, and I'm sure there are people who do it both ways. But in your opinion, is it better to assign a variable in the class or in the constructor? For example (regardless of syntax or language, this is just to explain):
public class Example
{
private final int TIME_STAMP = Now();
private int num = 2;
...
In the book Domain Driven Design, by Eric Evans, in Chapter 6 in the section on "Factories" (page 139) it says the following:
"The two basic requirements for any good FACTORY are:
...
"2. The FACTORY should be abstracted to the type desired rather than the concrete class(es) created."
Could you please elaborate on what is meant by t...
Hello, I am writing a "Date" class for an assignment and I am having trouble doing one the of the functions.
This is the header file for the class.
class Date
{
public:
Date(); // Constructor without parameters
Date(int m, int d, int y); // Constructor with parameters.
// accessors
int GetMonth(); ...
Hi,
I have the following database model:
[User]
Id
Name
[Role]
Id
Name
[UserRole]
UserId
RoleId
IsActive
And I want to create a nice way to represent this relationship and the property that is in it with objects without creating a class to represent UserRole table.
Any ideas?
Thanks a lot!
...
Ok so I have a package for a Memory System...I have Class Memory, MemEl and Test....I need some help editing my code..i cant figure out whats wrong with it. So if you could give me some pointers or help me edit my code, it would be very helpful...Thanks...also for my MemEl I am trying to make a constructor for MemEl(Int), MemEl(long), an...
Let me start with a concrete example. In C++, I have a hierarchy of classes under the abstract base class CollisionVolume. Any collision volume needs to be able to detectCollision with any other volume. This collision code is specialized based on the two subclasses in presence, but it is commutative: detectCollision(a, b) == detectCollis...
i know that these 2 languages require oop.
but inside the classes, could you have procedural code?
and for the mvc part, that pattern comes with their frameworks right?
nothing to do with the actual language itself?
...
I've got an MVC application written with Zend Framework that pulls data from an Oracle 10g database and displays this data in Tables and Lists and visually enriches this data through colors and charts. There is no ORM and no Create, Update or Delete involved, just pure Reading. The data is inserted from another application. The data in t...
Hi.
So I have started my initial design of a simple system.
I have a superclass/abstract called Customer. It has 2 subclasses: PrivateCustomer and BusinessCustomer.
I also have an account class. This account may be a downpayment account or just a regular account. It it determined by a Enum.
The Customer class has a List<> of accounts....
Hello,
I show you firsly my class :
as you can see I repeated several times $versionId param because all the method needs it. I am asking myself if there is a way to factorize it so there is lesser repetition.
<?php
class Admin_Model_Version
{
private $_db;
private $_versionId;
private $_path;
public function __construct()
{...
Is there a definitive reference on this in programming?
I see a lot of people refer to deep copying and cloning as the same thing. Is this true?
Is it language dependent?
A small point, but it was bothering me...
...
How to get code complexity metrics for a program?
well i wanted to create a program that check and score a code on how complex it is for example how many loop, if statements, if there is any nested loops etc. so for example a code with no loops, or if staement is not complicated.
EDIT: note that this question is about code complexity, ...
I would like to create an object in PHP based on a type defined by a string in a MySQL database. The database table has columns and sample data of:
id || type || propertyVal
1 || foo || lorum
2 || bar || ipsum
...with PHP data types
class ParentClass {...}
class Foo extends ParentClass {private $id, $propertyVal; ...}
class Ba...
This question led me to wonder about thread-local storage in high-level development frameworks like Java and .NET.
Java has a ThreadLocal<T> class (and perhaps other constructs), while .NET has data slots, and soon a ThreadLocal<T> class of its own. (It also has the ThreadStaticAttribute, but I'm particularly interested in thread-local ...
I have a pretty simple scenario here and it works, but my instincts tell me I'm making a mistake and would like to run it by some better minds.
Here I have a parent class that instantiates a MenuClass and handles transitions between pages.
public class ParentClass extends Sprite
{
public function ParentClass()
{
setupOp...
how do you declare a class property as a object?
i tried:
public $objectname = new $Object();
but it didnt work.
and why should you do it like this that?
isn't it better to just instantiate that object and just use its members?
...
I've got a .NET Web Service Reference to a 3rd party WSDL.
In that reference are 2 classes. Basically these 2 classes are most likely Interfaces on the 3rd Party API side but in .NET end up as 2 proxy classes.
I have a need to combine both these classes into one class. Why? Because it's stupid that these are split, they're the servi...
What websites (not books) document designs (UML or otherwise) for software applications?
Building architects have many resources available for inspiration and construction. I do not seek resources on constructing software (such as Meyer's Object-Oriented Software Construction), but rather examples of designs for software components or c...