1
vote
3answers
135 views

How to make a random-access archive of text files?

I wrote an application that tests the performance of evolutionary algorithms. This application performs a run of the algorithm which consists of several generations. The data which is produced by my ...
6
votes
4answers
444 views

Split up large interfaces

I'm using a large interface with about 50 methods to access a database. The interface has been written by a colleague of mine. We discussed this: Me: 50 methods is too much. It's a code smell. ...
0
votes
0answers
38 views

How would I do a vim-style character text editor in a graphical application?

There's a cool guitar tabbing application that I've used before where you can use the keyboard to move around a character grid. You can put any digit in any character cell. Here is an image: This ...
1
vote
4answers
215 views

Combinatorial explosion of interfaces: How many is too many?

I'm a relative newcomer to OOP, and I'm having a bit of trouble creating good designs when it comes to interfaces. Consider a class A with N public methods. There are a number of other classes, B, C, ...
2
votes
1answer
171 views

Is there a Design Pattern for preventing dangling references?

I was thinking about a design for custom handles. The thought is to prevent clients from copying around large objects. Now a regular handle class would probably suffice for that, but it doesn't solve ...
1
vote
1answer
43 views

Handling Types for Real and Complex Matrices in a BLAS Wrapper

I come from a C background and I'm now learning OOP with C++. As an exercise (so please don't just say "this already exists"), I want to implement a wrapper for BLAS that will let the user write ...
3
votes
1answer
79 views

Access items of a container with a pattern

I've two C++ classes with a relation: a container class which has a list of items. For example a library has got many books. The classes are the library and the book. Now from the external world I ...
0
votes
1answer
112 views

Is it better to pass the whole object or use a setter?

Here is my initial code that I would like to modify by using strategy design pattern. class Bar { int a; int b; ... } Class Foo { Bar *bar; bool action1(){ // this function does a ...
0
votes
2answers
213 views

Can this argument be enough?

We have two C++ classes named Important and Small The class Small use a few methods and attributes from the class Important, but not all. Since our application is performance critical, instead of ...
1
vote
4answers
295 views

Wrapper around C++ STL

Where I work we have our own system library, which pretty much is only wrappers around the STL, such as: template <typename T> class HVector { protected: std::vector<T> data; public: ...
1
vote
3answers
343 views

Should I pass array or pointer?

I am writing a C++ library (but prefer C style interface functions) and one of the function returns array of floats. I am not sure if I should pass pointer or fixed array to get this data? // in the ...
1
vote
2answers
110 views

Initialization of objects in a system using dependency injection

This is a follow up question to the following post: Injecting dependencies (DI) in c++ applications In a system that uses DI, someone, somewhere should be responsible to create the various objects ...
2
votes
2answers
175 views

Injecting dependencies (DI) in c++ applications

I am playing with dependency injection, but i am not sure I am doing it right. Especially, I am not sure what should be the correct way to build classes with injected dependencies. Say I have a class ...
2
votes
1answer
298 views

When not to move a “C style” code to “C++ or Object Oriented” code?

Context I am (part of team A) developing a piece of functionality which depends on new APIs provided by team B. Old APIs (also provided by Team B) are there and this is how they are being used in our ...
1
vote
5answers
628 views

How do I deal with global variables in existing legacy code (or, what's better, global hell or pattern hell)?

So... We have this fairly complex project (~10k LOC, but there's duplicated code so it's hard to tell) with hundreds of global variables. The project has more dependencies on other projects, and many ...
0
votes
1answer
761 views

Is this proper OO design for C++?

I recently took a software processes course and this is my first time attempting OO design on my own. I am trying to follow OO design principles and C++ conventions. I attempted and gave up on MVC for ...
0
votes
2answers
110 views

Design principles : classifying different types of class [closed]

I'm trying to clarify the design of a C++ application, and would like to define a clear classification among classes to aid clarity. However I'm struggling to find any literature to help me, probably ...
0
votes
0answers
61 views

On the process of replacing an internal framework by a public one [duplicate]

I am working on several applications which depends on a framework which was developed by a prior engineer in the company. The framework was mainly developed and maintained in the early 2000s, and ...
1
vote
2answers
114 views

Maintaining independence between modules

I am reading Algorithms 4th Edition by Robert Sedgewick and in chapter 1.2 it discusses API design. It says: "The key to success in modular programming is to maintain independence between modules. ...
1
vote
0answers
126 views

How to organize points on a sphere in bins and navigate between bins?

I'm having trouble coming up with a suitable way to navigate through a set of star coordinates in the Equatorial Coordinate System. My goal is to display those which are within a given range of ...
1
vote
2answers
180 views

Large number of projects for a single application

I'm working on 300K line C/C++ Windows application that is spread across 23 different Eclipse projects (approximately one third for Qt interface, one third for DLLs and one third for static ...
14
votes
2answers
635 views

Which is better: a bunch of getters or 1 method with a selection string parameter?

Our knowledge domain involves people walking over a pressure-recording plate with their bare feet. We do image recognition which results in objects of the 'Foot' class, if a human foot is recognized ...
0
votes
2answers
89 views

I need advice for a subsystem design?

I'm doing it in C++, I can't post the entire thing, because it's gigantic, I'll just sum it up with a simple example.I have: class B; class A { //Members and methods... void DoSomething(B* ...
0
votes
1answer
193 views

Does C++ support subtyping?

I know it might be a silly question to ask, but I didn't quite get an a absolute clear answer on this matter, so I thought I'd put it here. Does c++ support the subtyping in the sense that it ...
3
votes
2answers
234 views

Semantic coupling vs. large class

I have hardware I communicate with via TCP. This hardware accepts ~40 different commands/requests with about 20 different responses. I've created a HardwareProxy class which has a TcpClient to send ...
1
vote
3answers
359 views

Is it bad practice to check object types with an identifying member variable?

Preamble: I am making a simple board game in C++, in which AI characters move around squares on the board. There are different types of squares, each inherited from an abstract class, each with ...
4
votes
3answers
1k views

Is it bad practice to make an iterator that is aware of its own end

For some background of why I am asking this question here is an example. In python the method chain chains an arbitrary number of ranges together and makes them into one without making copies. Here is ...
1
vote
1answer
529 views

How to design a log() method that can easily be accessed from the outside of the Console class?

Recently my team has programmed a custom developer console in a video game which can easily be hidden or displayed, because it's more comfortable and less of a hassle. The Console class contains a ...
1
vote
1answer
305 views

a lot of small objects - OO pasta [closed]

In the code I am working on, there are a lot of really small objects like: class HasFieldLameSetter { public: HasFieldLameSetter(field& p_):m(_p){} void set(bool p2) ...
2
votes
2answers
226 views

How do I get rid of cyclic references in this design?

I have 3 classes: Meeting, Project and Agenda. A Project contains all sort of information + a list of meetings. The Agenda contains a list of upcoming Meetings. A Meeting contains some data + a list ...
2
votes
3answers
348 views

How can I effectively manage long-term feature development and short-term bug fixing at the same time?

We have a huge C, and C++ code base. There is a plan to add a new feature into the existing system, but, this should happen only after 3 to 4 months. So, we are looking for best possible options. ...
2
votes
1answer
177 views

Design of interface for finding one of something or a list

I am developing a telephony call model and thinking about how best to design the interface. One basic idea is that a call has a unique call identifier. I have a list of calls and finding a specific ...
0
votes
3answers
214 views

Application qos involving priority and bandwidth

Our manager wants us to do applicaiton qos which is quite different from the well-known system qos. We have many services of three types, they have priorites, the manager wants to suspend low priority ...
-3
votes
1answer
108 views

How do you call the discipline which consist of making the right choice of language/paradigm/class diagrams? [closed]

As a physicist, I've learnt programming on my own. But I would like to know the name of the discipline (like algorithmics is the discipline of designing algorithms) which consists of : making the ...
3
votes
3answers
374 views

Alternative inheritance paradigms in object-oriented design

My apologies if a variation of this question has been asked before, but due to its nature it is hard to search for. I am having a discussion with a colleague about object-oriented design, and it ...
4
votes
1answer
285 views

Is using protected inheritance to hide (but exploit) implemented interface from the public ok?

Recently, we had a discussion about code using protected inheritance in order to hide the fact (to client code) a class inherits from a specific base class but to exploit this fact in the ...
1
vote
2answers
215 views

Event based logging. Is it a good idea and is it ok to pass a handle to a “logged” object?

Hi I have fairly complex program that is doing computations in a quite large loop. I want to log some basic statistic about the run to be able to analyze its performance over time and vs loop number. ...
0
votes
1answer
106 views

Share Mulitple Classes as one dll or a lib with Mulitple Projects

Currently I have some shared class files(.cpp and .h) which I include them in around 20 Projects. Currently I have to include them in all of the projects. So if I get some business requirments and I ...
1
vote
1answer
140 views

Design for migrating to Multitenant architecture

We are in a process of redesigning our product code in such a way so as to support multitenancy. Currently the implementation is such that one product deployment caters to only one customer. Thus ...
1
vote
2answers
305 views

Statistics collection engine for C++ systems

We have a research project with idea->prototype->statistics development cycle. Anyway, our final product is a prototype, so the statistics collection suite is not used persistently. Supposing I have ...
0
votes
3answers
449 views

Design for multiple type return

I am working in C++ and I have this problem. class Container { Container(int which_type_to_use_a_b_or_c); A & getData(A & prototype); B & getData(B & prototype); C & ...
10
votes
4answers
897 views

Command pattern design

I have this old implementation of the Command pattern. It is kind of passing a Context through all the DIOperation implementation, but I realized later on, in the process of learning and learning ...
11
votes
3answers
2k 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 ...
1
vote
2answers
195 views

Would it be bad design to abstract a graphics library and wrap it in a single class? [duplicate]

I'm starting a game project in C++ using the SFML. It provides various classes for handling graphics, input, etc, but I would like to wrap it all up in a single Media class. I believe that by doing ...
3
votes
1answer
1k views

C++ Design: Functional Programming vs OOP

Design Question Recently, I've been doing more and more FP in C++, mostly in the form of function templates and lambdas, and heavy overloading of a single function name. I really like FP for some ...
0
votes
1answer
236 views

Scientific software design [closed]

I asked this question over at stackoverflow and it was suggested a tighter form be posted here. Many early career numerical researchers face the prospect of having to create performance critical ...
3
votes
1answer
401 views

Encapsulate bitmap (*.bmp) as C++ class

How would you implement / design a class which has to represent a bitmap? I'm stuck at handling the different possible color modes and I keep thinking that this should be somehow implementable using ...
2
votes
2answers
104 views

share code between check and process methods

My job is to refactor an old library for GIS vector data processing. The main class encapsulates a collection of building outlines, and offers different methods for checking data consistency. Those ...
1
vote
2answers
261 views

What is a useful pattern to maintaining an object state in a one to many relationship?

I am looking for a design for my application, here are the players(classes) involved. struct Transform { // Uses a matrix to transform the position. // Also acts acts as the state of a ...
5
votes
13answers
851 views

Limitations of Polymorphism in statically typed languages

I program mostly in statically typed languages, like C++ and Java. A common strategy employed in languages like these to handle dealing with collections of objects which are related, but which need ...