The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
22 views

Notice that a slide is empty

I got a table of slides(objects) which are displaying 1-4 elements(objects) in that style: **** SLIDE 1 * Element 1 * Element 2 * Element 3 * Element 4 **** SLIDE 2 * Element 5 ...
1
vote
2answers
283 views

What is the purpose of creating a member function with the same type as its class?

I'm sure I'll botch some of the specific terminology, but what is the difference between object and object2 in this implementation? Is the only purpose of the first method (prototyping the class's ...
0
votes
1answer
113 views

Android, using a Fragment to hold/edit complex object, accesible from any Activity

I'll do my best to describe the problem, but I'm still very new to several concepts that I think this problem requires to be solved (namely interfaces and threads). I should preface this by saying ...
0
votes
1answer
125 views

Should an object query its owner?

I have a World class World: def __init__(self): self.size = 10 self.n_busStops = 10 self.busStopMatrix = SpatialGraph(self.size, self.n_busStops, 1.0) self.buses ...
1
vote
2answers
179 views

Instantiating objects in Java [closed]

I'm learning now Java from scratch and when I started to learn about instantiating objects, I don't understand - in which cases do I need to instantiate objects? For example I'm studying from TutsPlus ...
1
vote
1answer
54 views

Replaceable parameter syntax meaning

Replaceable parameter syntax for the console object in C#. I am taking the O'Reilly C# Course 1 and it is asking for a replaceable parameter syntax and it is not very clear on what that means. ...
17
votes
11answers
2k views

When would you want two references to the same object?

In Java specifically, but likely in other languages as well: when would it be useful to have two references to the same object? Example: Dog a = new Dog(); Dob b = a; Is there a situation where ...
1
vote
1answer
89 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): ...
1
vote
2answers
168 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
555 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
2answers
810 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 ...
-1
votes
1answer
156 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
183 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 ...
-1
votes
2answers
166 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
288 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
2k 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
960 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 ...
0
votes
1answer
112 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 ...
1
vote
1answer
193 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 ...
2
votes
4answers
1k 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: ...
3
votes
1answer
170 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 ...
2
votes
0answers
195 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
85 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
245 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 ...
2
votes
1answer
555 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
166 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 ...
9
votes
1answer
9k 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 ...
35
votes
6answers
3k 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 ...
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
195 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
622 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 ...
6
votes
2answers
445 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
706 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
4k 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 ...