I'm opening multiple files and processing them, one line at a time. The files contain tokens separating the data, such that sometimes the processing of one file may have to wait for others to catch up to that same token.
I was doing this initially with only one thread and an array indicating with true/false if the file should be read in...
Hi,
I'm trying to apply OCP to a code snippet I have that in it's current state is really smelly, but I feel I'm not getting all the way to the end.
Current code:
public abstract class SomeObject
{}
public class SpecificObject1 : SomeObject
{}
public class SpecificObject2 : SomeObject
{}
// Smelly code
public class Model
{
publ...
Greetings all, I'm looking for a more efficient way to grab multiple users without too much code redundancy.
I have a Users class, (here's a highly condensed representation)
Class Users {
function __construct() { ... ... }
public static function getNew($id) {
// This is all only example code
$sql = "SEL...
I'm looking for an diagram tool for producing diagrams from text. I only really need sequence and state type diagrams for now, but I'm curious as to what people would recommend? I need something which is standalone, not a web based tool that works on Linux, OSX and Windows.
...
Hi Folks,
We have a current WinForm/Windows Service running in .NET 1.1 out on various customer sites that is getting data from internal systems, transforming it and then calling a Web Service synchronously.
This client app will no longer work in Vista or Windows 7 etc.. and its time to update!!
I was looking for ideas on what I coul...
I'm designing a simple expander control.
I've derived from UserControl, drawn inner controls, built, run; all ok.
Since an inner Control is a Panel, I'd like to use it as container at design time. Indeed I've used the attributes:
[Designer(typeof(ExpanderControlDesigner))]
[Designer("System.Windows.Forms.Design.ParentControlDesigner, ...
C++ is my first language, and as such I'm used to whitespace being ignored. However, I've been toying around with Python, and I don't find it too hard to get used to the whitespace rules. It seems, however, that a lot of programmers on the Internet can't get past the whitespace rules. From what I've seen, peoples' C++ programs tend to be...
Hi!
I'm trying to implement some sort of 'just-for-me' game engine and the problem's plot goes the following way:
Suppose I have some abstract interface for a renderable entity, e.g. IRenderable.
And it's declared the following way:
interface IRenderable {
// (...)
// Suppose that Backend is some abstract backend used
// for re...
Hi.
I had a pagination related question posted earlier. Here
I went through the posted answers and suggested choices and I realized that to implement pagination in an application I could still write db level queries and ensure that I could implement pagination, even if in a crude form. However I have few follow up questions now:
I am ...
Hi All,
As I am very new to programming, I am very curious about learning the best ways/practices of programming.
Whenever I want to write any program, I start directly with coding while some guys say that you should plan your program first before starting the code.
But I don't understand the real value of creating the class diagrams ...
So here's my problem: I have two types of registration, registration A and registration B, each will have some of the same fields and some different fields. I was going to create abstract class registration and both A and B would have their own classes that extend from registration. My question is, should I create a seperate Validatio...
Hey,
this is more of a usability/design approach, rather than "how" question. It is html 5 and web 2.0 age, and I want more than just "select/submit" buttons.
My question is regarding blog application: I want to have a nice way to upload and attach images to posts. Right now layout is simple: it has subject and body (for body I have BB...
I am going to be implementing a small custom CMS for a website. I was wondering if there are any more popular methods for implementing pagination using OOP. Thanks!
...
Hi!
The question plot (a bit abstract, but answering this question will help me in my real app):
So, I have some abstract superclass for objects that can be rendered on the screen. Let's call it IRenderable.
struct IRenderable {
// (...)
virtual void Render(RenderingInterface& ri) = 0;
virtual ~IRenderable() { }
};
And suppose...
Yesterday, I was designing a Java class which I wanted to be initalized with Lists of various generic types:
TheClass(List<String> list) {
...
}
TheClass(List<OtherType> list) {
...
}
This will not compile, as the constructors have the same erasure.
I just went with factory methods differentiated by their names instead:
publi...
I have a little problem that involves modeling a state machine.
I have managed to do a little bit of knowledge engineering and 'reverse engineer' a set of primitive deterministic rules that determine state as well as state transitions.
I would like to know what the best practices are regarding:
How to rigorously test my states and st...
I have an "Enemy" object, that have many "gun" . Each "gun" can fire "bullet". Storing "gun" is using an array. when the "gun" is fired, the "bullet" will be created. And the enemy object will have an array to store the "bullet".
So, I am thinking about the fire method. I am think making a firebulletFromGun in the "enemy". It need have ...
Hi!
Here is the question's plot: suppose I have some abstract classes for objects, let's call it Object. It's definition would include 2D position and dimensions. Let it also have some virtual void Render(Backend& backend) const = 0 method used for rendering.
Now I specialize my inheritance tree and add Rectangle and Ellipse class. Gue...
I am designing a remote CD/DVD burner to address hardware constraints on my machine.
My design works like this: (analogous to a network printer)
Unix-based machine (acts as server) hosts a burner.
Windows-based machine acts as client.
Client prepares data to burn and transfers it to the server.
Server burns the data on CD/DVD.
My ...
I have a hobby project, which is basically to maintain 'todo' tasks in the way I like.
One task can be described as:
public class TodoItem {
private String subject;
private Date dueBy;
private Date startBy;
private Priority priority;
private String category;
private Status status;
private String notes;
}
As...