The class tag has no wiki summary.
-1
votes
1answer
78 views
Simple C++ menu class with callbacks(), non-GUI [on hold]
I asked this on SO.SE and they held my question as not on topic. I'm trying here in the hopes someone with a little more experience than I might share.
I'm looking for a C++ class that implements a ...
-3
votes
1answer
114 views
Having problem understanding classes C++ [closed]
I am studying classes from book Sams Teach Yourself C++ 1 hour a day and New Boston Video Tutorial of C++.The problem is that in the video tuts he creates classes with(USING CODEBLOCKS) new -> class ...
0
votes
1answer
66 views
Reading a specific type of input from file
I have a software that reads from a file. Each object in the software takes 7 inputs viz. string string string float string float int
I have an input file. It contains a number of input values. If ...
0
votes
2answers
135 views
Is it valid to initialize an instance of a class within the same class?
I was wondering if it's valid to initialize an instance of a class within the same class? For example:
public class Person()
{
string name;
string age;
public Person getPerson()
{
...
2
votes
2answers
189 views
Start by Teaching Classes [closed]
In every class, and every book I have seen regarding programming, classes are held off. They are thought to be confusing and strange. I certainly had issues with them.
But in object orient ...
2
votes
2answers
105 views
Will object reuse optimize this often-called function?
Suppose I have a function that I need to call a lot, maybe a few thousand times on every mouse down or mouse move. It uses an instance of a function (class), called Transform:
function func1(a, b, c) ...
1
vote
3answers
152 views
Avoid malicious code while dynamically loading classes with ClassLoader
Background
One of the advantages of decoupled components in systems is that you can extend the system without having to touch the existing code.
Sometimes you don't even have to recompile the old ...
2
votes
2answers
129 views
Should I split a Python class with many methods into multiple classes?
I have a class that will end up having more than ~30 methods. They all make sense to be part of the same class because they require access to the same data.
However, does it make any sense to split ...
5
votes
5answers
696 views
When to use primitive vs class in Java?
I see that Java has Boolean (class) vs boolean (primitive). Likewise, there's an Integer (class) vs int (primitive). What's the best practice on when to use the primitive version vs the class? ...
3
votes
2answers
225 views
application logic, business logic, models, controllers - where to put the application's brains?
I'm trying to wrap my head around models, views, and controllers, but I feel as though the more I read, the more conflicting information I seem to encounter. I guess the general goal is--as far as ...
2
votes
6answers
224 views
Should all classes have a default constructor as part of good coding convention
From the texts I have read so far, the conventions talk about organizing constructors, starting with the default, if any. I am wondering, should all classes have a default constructor anyway. This ...
1
vote
3answers
280 views
Keeping track of all objects of a class
I'm new to object-oriented programming, and I keep running into this issue. (I'm programming in Java) I've been a bit reluctant to ask about this, since it seems like such a basic issue, but I can't ...
19
votes
4answers
944 views
How do purely functional languages handle modularity?
I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be ...
0
votes
1answer
146 views
PHP function types
I am trying to find a way of classifying different types of PHP functions. For example that fopen, fwrite, fclose and so on are all part of IO, and the MySQL functions and MySQLi class is all for ...
4
votes
4answers
992 views
Was C designed to facilitate Object-Oriented programming?
I am trying to broaden my understanding of the history and development of object-oriented programming, and I am curious to find out
if C was designed to facilitate Object-Oriented programming? (like ...
0
votes
1answer
203 views
Teaching `class`es and objects in C++ to university students
To learn classes and objects at my university, students are required to develop a simple game (nine-mens morris or something similar) using Java. Java is used because of its libraries and tool ...
1
vote
1answer
170 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 ...
1
vote
3answers
422 views
Legitimate reasons for circular references in C++
I have project written in C++ that I am working on which has a parent-child relationship where each child has only one parent. I had previously decided after looking at this post that I would make the ...
1
vote
1answer
52 views
Do I include association links for Objects that only have method scope in UML class diagrams
For example I have a utility Class which contains a few constants (GCMConstants), this class is used in one method in the application. However as it is not a member of the Class it should not be ...
1
vote
1answer
139 views
Do I include third party classes in my UML class diagrams
I'm developing a system which involves 2 Android applications and a Java web application. For my UML class diagrams I have not included third party classes I use e.g. observer type interfaces. Should ...
8
votes
3answers
738 views
How to avoid “managers” in my code
I'm currently re-designing my Entity System, for C++, and I have a lot of Managers. In my design, I have these classes, in order to tie my library together. I've heard a lot of bad things when it ...
6
votes
6answers
906 views
Why Java does not allow function definitions to be present outside of the class?
Unlike C++, in Java, we cannot have just function declarations in the class and definitions outside of the class. Why is it so?
Is it to emphasize that a single file in Java should contain only one ...
4
votes
1answer
113 views
Advices on structure and names for namespaces and classes
I'm resistant to calling the "main" class the same as the namespace, but I sometimes find myself needing it. Considering I'm using the Vendor.Namespace.[Subnamespace].Class formula, imagine this ...
8
votes
2answers
332 views
Refactoring several huge C++ classes / methods. How to start? [duplicate]
Possible Duplicate:
I’ve inherited 200K lines of spaghetti code — what now?
I'm dealing with legacy code. It contains some BIG classes (line count 8000+) and some BIG methods (line count ...
1
vote
1answer
156 views
Is there a good design pattern for this messaging class?
Is there a good design pattern for this?
I want to create a messaging class.
The class will be passed:
the type of message (eg. signup, signup confirmation, password reminder etc)
the client's id
...
8
votes
7answers
707 views
Is it appropriate for a class to only be a collection of information with no logic?
Say I have a class Person that has instance variables age, weight, and height, and another class Fruit that has instance variables sugarContent and texture. The Person class has no methods save ...
0
votes
4answers
270 views
Practical Usage Of Structures in c# [duplicate]
Possible Duplicate:
When do you use a struct instead of a class?
While working in OOPs, we always battle around structures and classes.
But in real world, we always sticks to classes. I ...
18
votes
5answers
1k views
How do I prove or disprove “god” objects are wrong?
Problem Summary:
Long story short, I inherited a code base and an 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 ...
0
votes
1answer
411 views
Class Design and Structure Online Web Store
I hope I have asked this in the right forum.
Basically, we're designing an Online Store and I am designing the class structure for ordering a product and want some clarification on what I have so ...
2
votes
1answer
368 views
What is meaning of the term “Sans” in a class name?
I was reading code of a java project where I found a class name like "UserSansXml". This class is dealing with user objects. I wanted to know the meaning of "sans".
16
votes
5answers
982 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++, ...
2
votes
3answers
977 views
Functions returning pointers
C++ noob here. I have a very basic question about a construct I found in the C++ book I am reading.
// class declaration
class CStr {
char sData[256];
public:
char* get(void);
};
// ...
2
votes
3answers
722 views
Is there any Common Name for Edit,Save,Delete,Select
Can anyone suggest me a Common Name for Edit,Save,Delete,Select
I want to create a Interface in C#, which will support all these methods.
My Context is :
I am developing an Invoice Application in ...
-2
votes
1answer
340 views
Don't Use Static? [duplicate]
Possible Duplicate:
Is static universally “evil” for unit testing and if so why does resharper recommend it?
Heavy use of static methods in a Java EE web application?
I ...
-3
votes
8answers
1k views
Why do we need to separate classes which have different functionality? [closed]
Why do we need to separate classes which have different functionality? For example, why should we separate a car class from a paint class. What would be the OOD concept behind this? Is there anything ...
56
votes
8answers
5k views
Don't Use “Static” in C#?
I submitted an application I wrote to some other architects for code review. One of them almost immediately wrote me back and said "Don't use "static". You can't write automated tests with static ...
5
votes
5answers
1k views
What do you call classes without methods?
What do you call classes without methods?
For example,
class A
{
public string something;
public int a;
}
Above is a class without any methods. Does this type of class have a special name?
8
votes
4answers
1k views
Return interface or class
Suppose I have a method
public List<User> GetBatchOfUsers(IEnumerable<int> userIDs)
{
List<User> users = new List<User>();
// some database stuff
return users;
}
...
1
vote
1answer
92 views
How to represent association in programs [closed]
Could someone help me in implementing association in cpp. I am trying to implement a dice game where I have two classes a diegame and a dice.
0
votes
2answers
459 views
Should I create specific classes for JSON Objects or only use the container(Array/Dictionary) for accessing Data?
I'm using Foursquare to get a List of Restaurants nearby inside an iOS app. The Result is stored in an Array which consists of Dictionaries and regarding how deep the Data is, each Dictionary contains ...
39
votes
11answers
4k views
Why is it good to split a program into multiple classes?
I'm still a student in high school (entering 10th grade), and I have yet to take an actual computer course in school. Everything I've done so far is through books. Those books have taught me concepts ...
-1
votes
1answer
411 views
What is the difference between class level attributes, Class constants and singleton methods?
What the difference given they all exist 'once per class'.
When should I use one over another, i.e. for what purpose?
I use Ruby.
0
votes
2answers
721 views
Is it best practice to always capitalize class file names in PHP, and other languages?
I ask because I've seen a couple of OO PHP tutorials which do not adhere to this, but to me it just makes sense. It makes it easy to instantly see if a file is a class or not, if non-class files all ...
8
votes
4answers
297 views
Origin of structures and classes
What design and implementation issues did programmers have to solve when they decided first to use structures and classes?
When did this happened and who were the pioneers behind these ideas?
Note, ...
0
votes
2answers
307 views
Identify name of class which does CRUD operations
Using my application (which I am currently developing), Admin can assign addresses (not only assign, it is something like CRUD operations) to salesRep, so that those addresses will be listed under ...
13
votes
7answers
4k views
What are the roles of singletons, abstract classes and interfaces?
I am studying OOP in C++ and, even though I am aware of the definitions of these 3 concepts, I cannot really realize when or how to use it.
Let's use this class for the example:
class Person{
...
0
votes
1answer
360 views
How do I start correctly in building database classes in c#?
I am new in C# programming and in OOP. I need to dive into web applications for my company, and I need to do it fast and correct.
So even that I know ASP.NET MVC is the way to go, I want to start ...
1
vote
3answers
264 views
Any language where every class instance is a class too?
Taking inspiration from Javascript prototypes, I had the idea of a language where every instance can be used as a class.
Before I potentially reinvent the wheel, I would like to ask if there is a ...
4
votes
2answers
184 views
How to deal with variables when extracting methods in to smaller methods?
This is an abstract question to clarify a refactoring concept in the ruby language. Assume in the real world that there would be many more variables and method in the Furniture Class and Refinish ...
2
votes
2answers
342 views
GUI architecture and class naming advice
Problem:
I'm working on coding a few light-weight touch-tablet games and often get stuck with difficulties naming my user interaction/interface classes and their relationships with each other ...