Questions that deal with the organization and structure of the code should be given this tag.
0
votes
0answers
12 views
Good practice of using android activities [on hold]
I completed few android apps successfully but always I feel that I am not following the best practices of android developnment.
Few things which makes me feel developing a 100% complete android app ...
4
votes
2answers
136 views
Solving 15 puzzle
I'm trying to solve 15 puzzle using A* algorithm, but something really bad goes on in my get_solution() function that ruins perfomance. I guess there is a too much usage of maps in here, but I don't ...
2
votes
1answer
23 views
Backtracking Project
I had a duty: to make a project for my informatics course. I'm in 11th grade.
I've spent a week or so developing a program which solves these kind of problems (most of the time for designing):
...
3
votes
2answers
65 views
Performance problem getting student demographics report with ActiveRecord
I have two active records StudentDemographics and StudentWeeklyReport both having has_many relation like this:
class StudentDemographics < ActiveRecord::Base
has_many :student_weekly_reports, ...
5
votes
2answers
162 views
compare two logic commented one to my logic java
I'm trying to review this block of code to make sure logic is fine. The first version that I commented will create duplicated order 'my college developer' but I fixed it but "really not sure" I want ...
1
vote
0answers
77 views
Using LINQ ForEach instead of for/foreach (from a code quality PoV, not performance) [closed]
I was peer-reviewing some code recently and there was a particular thing that bothered me (although I could not tell why), regarding the use of LINQ expressions.
Every single loop was written as a ...
0
votes
2answers
78 views
What do you think about such code organization?
I'm working on mobile app which doing requests to servers API. I want to develop module that doing following:
get authorization key already exists in previous session
connect to server api and read ...
0
votes
2answers
56 views
Making code compacter?
I am currently working on a Python project. It is some sort of a hub, where you can do some cool but basic stuff, such as: setting timers, launching websites, doing basic math, ping and view source ...
0
votes
1answer
51 views
Review of String to Long bijection class - focus on readability/maintainabiliy
I wrote the following interface and class to bijectively map a string to a long. I would like feedback on how to make the code more readable and maintainable.
Interface:
/**
* Bijectively maps a ...
1
vote
0answers
59 views
Basic structure of a simple php REST api
I've read plenty about php OOP design principles and patterns. I can work with classes and inheritance. My issue is with actually using classes for some purpose. In this case, I want to create a ...
2
votes
1answer
75 views
Singleton has logic and state, and logic has state
------edit---------
note: this is for a MUD client, so the commands are issued to the MUD game server
-----end edit--------
For an overview, here's the structure of the project:
...
2
votes
1answer
125 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 ...
0
votes
0answers
70 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
131 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 ...
4
votes
2answers
139 views
Code organization for a text-based adventure game
I'm new to programming, and I would like to know if this is the right way to layout code. If anyone has any tips, please share them.
import random
import time
def displayIntro():
print("You are ...
1
vote
2answers
55 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
70 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
70 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
118 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 ...
2
votes
1answer
171 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
3answers
154 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
55 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
94 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
71 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
80 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
91 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
63 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>
...
0
votes
2answers
57 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
72 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
27 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
20 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
193 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
37 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
69 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
80 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
178 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
75 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
117 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
76 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
94 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
94 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 ...
1
vote
0answers
64 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 ...
1
vote
0answers
114 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
141 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
107 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
84 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
405 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
64 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
98 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
363 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 ...