Questions that deal with the organization and structure of the code should be given this tag.

learn more… | top users | synonyms

2
votes
1answer
61 views

Do I need to delete a vector?

I want to make a graph from input from a text file in the format: vertex1 vertex2 cost time where vertex1 and vertex2 are strings that form an edge and cost and time are the properties of that ...
1
vote
0answers
37 views

How to adjust Foreground extraction in prediction

This is my program for ForegroundExtraction, which I've made into a function: int ForegroundExtraction() { VideoCapture capture("recognition.mp4"); if (!capture.isOpened()) return 0; ...
3
votes
3answers
110 views

How would I decompose this method into multiple methods?

How would I decompose this java program into multiple methods? It first stores a string as input, then loops through it to extract all of the numbers into an array list. Then it prints all of these ...
1
vote
2answers
43 views

How to remove duplicate matching?

There are my shapes (for example): public abstract class Shape { protected int _id; protected string _description; public abstract string ToXml(); } public sealed class Triangle : Shape { ...
0
votes
0answers
37 views

Swing custom component organization system

I'm rewriting an old Swing project that I did a few months ago, a fairly simple copy-cat of MS paint. I've been doing a pretty good job of keeping the code maintainable and organized, but I've hit a ...
3
votes
1answer
62 views

In need of some aid in regards to making my code more efficient

I've created a form that gathers and submits information to SQL database via LINQ, and sends an email if all goes while saving the database and doing a redirect. Recently, it started submitting data ...
3
votes
2answers
113 views

C++98 Unique Pointer Implementation

The interface and some of the implementation is take from boost. However, it is intended to be transferable between projects by only copying one file. I have removed most of the policy classes in ...
0
votes
0answers
39 views

What is the proper way to store an object with many attributes in Objective-C? [migrated]

I have an object that I am downloading over HTTP, that has approximately 50 attributes. What is the proper way to store this information in Objective-C? Should I have an NSObject with a property for ...
0
votes
1answer
73 views

PHP framework building: Database Control Classes

I am building a PHP framework and would like to get some feedback on a few different sections of the project so far. I consider myself still a neophyte in PHP so I would like to ask if I'm going about ...
2
votes
2answers
121 views

Is there a better way of making an NSString with many argument values?

I have a form that I'm turning into a string value for an email, but the string value that I turn it into seems very complicated, plus I believe this way takes up a lot of memory and is somewhat slow ...
1
vote
1answer
34 views

Better ways of solving the substitution cipher puzzle

here is the puzzle description Your task is to decode messages that were encoded with substitution ciphers. In a substitution cipher, all occurrences of a character are replaced by a different ...
2
votes
0answers
65 views

First jQuery Plugin - SmoothSlider - Would appreciate a code review

I've been working with jQuery, mostly consuming plugins and using bits and pieces here and there for other functionality. Anyways, I wrote some standalone functionality in jQuery for a project and ...
2
votes
1answer
59 views

Maxheap code review in Java

Just looking for some feedback on my implementation of a maxheap mostly relating to style. Trying to create good habits as i learn to program. Constructive criticism is appreciated! Thanks. Note: ...
2
votes
2answers
68 views

General Review Wheel of Fortune Game - Redone

After posting this question I made some updates and changes to my code. My new demo for the game is located here: http://jsfiddle.net/maniator/XP9Qv/ I am trying to make a Wheel of Fortune game -- ...
1
vote
2answers
78 views

Review Python Script for creating a hierarchy of directories

This script creates an hierarchy of directories. I wanted to know whether this is a good approach or can it be made better? I am mainly concerned with maintainability not efficiency here. Suppose I ...
1
vote
1answer
58 views

Improving Hangman game

I'd like to know how this program can be improved. Any comments or critiques are most welcome. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> ...
1
vote
1answer
49 views

Is this a good way of handling item reservations?

I have a site were we sell unique items. When a user clicks to buy an item we have to reserve it. This prevents other buyers from purchasing the item while the first buyer is checking out. When a ...
1
vote
1answer
61 views

Critiques for program that integrates functions

The function is entered by the user as a series of coefficients and powers in the form of numerators and denominators. There is a little error somewhere with negative numbers that I'm working on ...
0
votes
1answer
22 views

javascript: data and vtables vs. objects and methods

I present a bunch of grids of data to the user, and want to sum certain columns in some of the grids. // for one such grid: rows = [{id: 0, name: "Alice", age: "23"}, {id: 1, name: "Bob", ...
2
votes
0answers
18 views

Javascript organise site's module

today I was wondering about on how to organise the code on my site , to make it clearer as possibile and clearly readable. I'm organising it with namespace, separating every single section of the ...
0
votes
0answers
120 views

enumerating windows to get process via c# & pinvoke approach

as i was trying to have a test and learn about native p/invoke functions i was trying to use only pinvoke and then compare the time it takes to get process info with .net simple Process myProc = ...
-1
votes
1answer
33 views

How do I make print function refer to something in a function without calling the function again? [closed]

So here is my code to find the number of weeks between two dates. How can I make the output print "There are 'x' weeks until 'future date'" without calling the futureDate() function? from datetime ...
1
vote
3answers
66 views

Ruby: Code review

I have recently started using Ruby and would like to hear your take on the following piece of code. class Generator def initialize @context = nil end def start(params) @context = ...
2
votes
1answer
56 views

How to write Fibonacci using register machine code [closed]

I am not sure whether this is the right place to ask this question, but since it involves programming and code, I think it is under the category of Code Review. The question is about how can I write ...
4
votes
1answer
156 views

C++ Linked List: Would This Code be Considered Clean If written in an Hour Long Interview

If you were interviewing me, and saw this code written in a little under an hour would you consider me as a candidate for a position at your company if you knew I had 2 years of C++ experience. ...
2
votes
1answer
53 views

Simple bash script for opening a repository in the browser from the command line

I'm relatively new to bash scripting, and I'm wondering how I've done on this. Basically it's a script where if I'm in a github or bitbucket repository in my terminal, I can type browse-repository to ...
2
votes
2answers
96 views

Best coding practice for classes

I just have a somewhat simple question on coding practices. I have never written a large application before and I am currently working on building a game engine in Javascript. The part that confuses ...
2
votes
2answers
68 views

Looking for code quality suggestions with my open source CFML database project

I just posted a small open source CFML project on github.com, https://github.com/jetendo/db-dot-cfc db.cfc is a standalone CFC with 472 lines of code. UPDATE: the code on github has changed a lot ...
2
votes
1answer
80 views

using C scope syntax for code organization purposes

Would you ever use curly braces for making your code more organized and readable? for instance I could have: - (void)methodName { ... // action 1 { ... } ... } Where ...
4
votes
1answer
74 views

Code Reiview for an PHP PDO Queries? is there a better way to do it?

so this is my code for a equipping an item in my game dev't: try { $db = getConnection(); $db->beginTransaction(); $sql_chara_gold = $db->query("SELECT chara_gold ...
0
votes
0answers
49 views

Orginization of Code

So I'm writing an app for android and I'm trying to figure out how to write it more efficiently. If I was writing it in Java, I would have had seperated the code into methods and classes but I'm so ...
0
votes
0answers
111 views

What's wrong with this javascript programming approach?

Helllo people I'm now developing an instant messaging system but I'm a little confused : I can't decide which approach do I have to choose! Here is a code and I want you to tell me what is good/bad ...
1
vote
1answer
136 views

Which code is better? And why?

I found two ways of writing the same program (one that only uses local variables, but no methods other than the main one) and other that uses one instance variable that is used in two methods. This ...
0
votes
1answer
92 views

Q&A system model design [closed]

Now I am trying to build a Q&A website by myself.The models below is my model design.I have some questions about this. 1、class Category: public class Category { private String name; } ...
1
vote
1answer
82 views

How do I shorten my code?

I currently have a huge code for regenerating some things in a game a made. The code is very big and I think it can be compressed but I don't know how to do it. This is the code Private Sub regen() ...
3
votes
2answers
199 views

Palindrome test in Haskell

I am new to Haskell and, coming from a OO/procedural programming background, I want to make sure my code follows the functional way of doing things. I built this short module to test if a given string ...
0
votes
1answer
63 views

Progressbar in Python

i wish to improve my Progressbar in Python from __future__ import division import sys import time class Progress(object): def __init__(self, maxval): self._seen = 0.0 self._pct = ...
3
votes
2answers
95 views

improve the design of class “accuracy” in Python

I am learning about the class and methods in Python. The class Accuracy is a class of several (13 in total) statistic values between a reference polygon and one or more segmented polygons based on ...
5
votes
4answers
289 views

Command line Contact Management

Can you please review the following code and give any suggestions for improvment? Class ContactList.java import java.io.*; import java.util.*; public class ContactList { public static void ...
4
votes
1answer
82 views

Thoughts on organizing code for multiple mysql queries in php scripts

I have a web application where I connect with a MySQL database using PDO and in some scripts there are a lot of queries one after the other which don't necessarily concern the same tables. i.e I will ...
2
votes
1answer
315 views

Am I using Golang concurrency correctly to increase reliability?

This code takes text from the standard input, maps it to a struct (if possible), and creates a JSON string from that. I'm using a barcode scanner for the input, and I've attempted to use goroutines ...
0
votes
1answer
28 views

Python right position for a Error message in a class

first of all sorry for this easy question. I have a class class Grid(object): __slots__= ("xMin","yMax","nx","ny","xDist","yDist","ncell","IDtiles") def ...
3
votes
3answers
157 views

Would like some feedback on code samples

I am currently in my 3rd year of a computer science course, I am looking into getting an internship over the summer but, I feel that my coding skills might be lacking for the workplace. Below, are ...
3
votes
2answers
131 views

Help me simplify this gigantic class

I'm trying to think of ways to separate things out. I'm open to ideas, or if you see anything blatantly wrong, I'd like to know that too. Generally, I'm happy with this, but the sheer size of the ...
0
votes
1answer
118 views

C#/XNA interface usage, repeating functions

Essentially I'm wondering if this implementation of an interface is correct. I mostly don't like having to repeat the exact same getters and setters. Is there a better way or is this alright? using ...
0
votes
1answer
156 views

Illustrating DI and IoC concepts

This question is a follow-up to the questions here: Illustrating DI and IoC concepts : Simple code requesting review I have taken the very good review comments got and tweaked the code. These are the ...
2
votes
2answers
230 views

Illustrating DI and IoC concepts : Simple code requesting review

I have written a little bit of code which illustrates DI(dependency injection) and IoC(Inversion of control) container. The point of this exercise is to illustrate the two methods by which you can ...
2
votes
1answer
114 views

looking for review of code organization for jQuery/javascript code

The first block of code is my main app.js that is included on every request. It is essentially a library of functions and objects that include related functions (ie: app.utils) that I can use on other ...
2
votes
2answers
168 views

Code Review - calculator which parses user input

I have written this program after a lot of effort, and I was wondering about the efficiency of that solution and if it's neat. So my question is, how plain is this program and is there any better way ...
0
votes
1answer
356 views

How to organize classes for blackjack game

I have to write blackjack game for college using processing language. It has to be done in a strict object oriented approach. So i can`t make an object of a class in another class unless there is some ...