The object tag has no wiki summary.
-2
votes
1answer
68 views
{newbie programmer}automatic object creation [on hold]
I will try to lay out my question.
I want to start from thought to implementation. I think a good language has to allow easy idea materialization. Concepts,thinking to application,action.
Not the ...
0
votes
1answer
46 views
Using class like an object in Python
I am learning from Learn Python the hard way where I have come across a study drill where they want to know that whether a class can be used like an object.
As I have experimented:
class A(object):
...
0
votes
1answer
121 views
Mock Objects: Real Issues, Test Driven Design with Java
I'm trying to create a mock class to check the operability of a 'Searcher object', the object I want to mock looks like this:
public class Searcher implements AristotelianSearcher
{
protected ...
-1
votes
0answers
91 views
What is the difference in using .length and .length() to find length [migrated]
The former (.length) isn't even a function , how does it return length?
32
votes
6answers
2k views
How do I prove or disprove “god” objects are wrong?
Problem Summary:
Long story short, I inherited a code base and a development team I am not allowed to replace and the use of God Objects is a big issue. Going forward, I want to have us re-factor ...
1
vote
2answers
149 views
Three variants of circular references between objects: how to choose?
I'm designing an object dependency graph of my program and one ambiguity between design variants appears from time to time.
Imagine two objects having a reference to each other. Obviously, at least ...
4
votes
5answers
453 views
Why is there no deterministic object destruction in Java? [duplicate]
I understand and enjoy the benefits of the Garbage Collection in Java. However I don't understand why there is no way in Java to explicitly (and quickly) destroy an object. Surely this could be useful ...
4
votes
3answers
603 views
What is the process of determining which method in a class hierarchy should execute known as?
I thought I understood inheritance and polymorphism, but I was given this question, and I can't, for the life of me, figure out what the proper answer is or what they're trying to get at:
The ...
4
votes
1answer
156 views
Class instance clustering in object reference graph for multi-entries serialization
My question is on the best way to cluster a graph of class instances around specifically marked objects (objects are the graph nodes and the references to each other are the directed edges of the ...
-1
votes
1answer
114 views
Size of objects during Multilevel inheritance [closed]
Below is a pseudo declaration for a multilevel inheritance.
Base class ( protected int data)
derived1 : virtual public base ( protected int data1 )
derived2 : virtual public base ( protected int ...
1
vote
5answers
157 views
Clarification about Polymorphism / Inheritance
I am trying to better my understanding of polymorphism.
Say I have a base class called baseClass with one method called foo() and I have three derived classes called derived1 , derived2 and derived3 ...
0
votes
2answers
125 views
Difference between a pointer and a reference? [duplicate]
In Java and other high-level languages, a reference leads to an object.
In C++, as far as I know, a pointer can also lead to an object.
So what's the difference between a reference leading to an ...
4
votes
1answer
233 views
Modelling Login and Authentication on an iOS mobile client
I'm about to start working on a V2 of a mobile application and I'd like to adopt a more object-centric approach. Primarily because I think it makes for more maintainable code, but a secondary ...
11
votes
3answers
1k views
How many strings are created in memory when concatenating strings in Java?
I was asked about immutable strings in Java. I was tasked with writing a function that concatenated a number of "a"s to a string.
What I wrote:
public String foo(int n) {
String s = "";
for ...
1
vote
3answers
486 views
Arrays vs Objects in view template
I am wondering, in view templates, what would contribute to me choosing between using arrays or objects for getting things printed out in arrays
{{$user->zip_code}} vs {{$user['zip_code']}}
I'm ...
1
vote
1answer
182 views
Loose typing not applied to objects
I have very little experience working with classes and object. I work in a loosely typed language, PHP.
I was working with a SimpleXML object and ran into a problem where I was trying to do math with ...
0
votes
1answer
101 views
Is creating a separate pool for each individual png image in the same class appropriate?
I'm still possibly a little green about object-pooling, and I want to make sure something like this is a sound design pattern before really embarking upon it. Take the following code (which uses the ...
2
votes
4answers
780 views
Returning multiple values in Javascript
Often I am writing a function that returns multiple values, such as a pair of coordinates:
function get_coords() {
return ???;
}
If I was using a language like Python, I would use a tuple:
...
9
votes
1answer
6k views
Design pattern for object conversion (java)
I don't use design patterns very often, besides an occasional factory and MVC, and I want to start using them more.
I have a concrete case at hand that I would like your opinion on the use of design ...
2
votes
0answers
159 views
Object Constraint Language (OCL) for Stack in java.util package
I have an exam coming up and I'm looking at past papers to get some ideas of what to expect.
I'm a bit stuck on the following one and would really appreciate if someone could give some example ...
1
vote
1answer
77 views
create function of object prototype
I am reading "Javascript : The good Parts" to improve my Javascript bases and knowledge. I was reading stuff about prototype and I encountered in this function :
var stooge = { ... }
if(typeof ...
8
votes
3answers
239 views
Is a single object to be preferred over multiple variables?
It was quite hard to put what I meant into a title, but it's easy to put into code.
C++
Is this
int offset_x = 10;
int offset_y = 40;
...
element.move(offset_x, offset_y);
To be preferred over ...
1
vote
1answer
402 views
Analogy of a class being a cookie cutter and objects being cookies
I came across the analogy of the class being a cookie cutter and the cookies being objects while reading Code Complete. I fail to see why this analogy was drawn.How is it related to the concept of ...
5
votes
1answer
163 views
Is it called an instance in Javascript?
Say I have a function.
function foo(){
//do stuff
}
And then I create an object of that function.
var fooObj = new foo();
What is fooObj called? An instance, An object instance, or something ...
16
votes
5answers
1k views
Why am I seeing so many instantiable classes without state?
I'm seeing a lot of instantiable classes in the C++ and Java world that don't have any state.
I really can't figure out why people do that, they could just use a namespace with free functions in C++, ...
1
vote
1answer
190 views
javascript - would you consider 'prototype' to be the same as 'parent'
I'm learning javascript.
I see that with an object, I can use .prototype, is it fair to say that, in a class/tree hierarchy I am effectively using the 'parent' (or 'ancestor' perhaps) by doing that? ...
4
votes
3answers
2k views
Why multiple calls to same classes' Constructor from within a Constructor wouldn't work?
Please have a look at following snippet:
public class Foo {
int digit;
String name;
Foo (int d, String n) {
this(d);
// cannot do following.
//compile-time error: Constructor call must ...
2
votes
6answers
577 views
How assertive should I be in handling exceptions in objects?
I have been writing in C# 4.0 a lot lately and trying to write as lean as possible. As such, I have not been using the classic try/catch blocks and using statements as often.
I understand the general ...
7
votes
4answers
335 views
Is there a standard, formal name for an object or class that behaves as if it is a given object?
I have an app in Django that expects to get a record with the fields email, first_name, and last_name.
However, sometimes I want to be able to send it something that isn't actually a record but ...
3
votes
5answers
570 views
Config Class/Struct: Pattern or Anti-Pattern? Alternatives?
If you add new configuration options to a program, it can often have tons of ripple effects in terms of getting the options to where they need to be acted upon. There are three basic ways to deal ...
7
votes
6answers
3k views
Is it called class or object instance?
I have a wording / precision question. Sometimes I write "object instance" sometimes "class instance".
Isn't it that an object is always an instance of a class? Therefore "object instance" is not the ...