Questions that deal with the organization and structure of the code should be given this tag.
8
votes
2answers
102 views
Can this while loop be made cleaner
Moved to Code Review as per comments received on http://stackoverflow.com/questions/20907502/can-this-while-loop-be-made-cleaner
Is there a way to make the following while loop a little more ...
1
vote
3answers
64 views
Three ways to add pronoun method/property to gendered class in Python
Say you have a Python class for something that has an optional gender field. You'd like a helper property/method to get the appropriate pronoun for an instance. You'd also like to be able to get the ...
1
vote
1answer
28 views
Coding upgrade (CSS3 x jQuery) tips
I'm just beginning web design, and I've come up with this code to scroll to a place in the same page.
I don't know if this can or should be improved much longer, so I'm asking for any tips that can ...
2
votes
1answer
35 views
Hot 18 game (modified Blackjack) in JavaScript
I've just completed my first JavaScript game. I strongly welcome any advice/opinions/insults on how crappy or good my game is.
Do you notice anything that is poorly done?
Is there anything that I ...
2
votes
1answer
61 views
Convert three functions into a single function
Is it possible to combine all the functions into a single function? I'm providing my fiddle as well.
I am trying to test it for different scenarios..
but I am not sure how to combine all the ...
2
votes
1answer
46 views
VARIANT structure deserialization code organization
In my project i work with COM object via System.Reflection. COM object returns pointer on structure VARIANT, that i cast as object and then i cast one as byte array. There are many structures that i ...
5
votes
5answers
115 views
cleaning up and increasing performance of js code
I would like to increase my performance of js code write a clean code... can you tell me how to do it... providing my fiddle below with js code...
http://jsfiddle.net/YYg8U/
var myNumbersToSort = ...
6
votes
1answer
79 views
Open source angularjs pouchdb model persistence layer - release ready?
I'm considering releasing a library as a bower module. Are there issues with code quality, missing test cases, that need to be addressed first? Perhaps it's not a good candidate for public release. ...
1
vote
2answers
175 views
Finally got a fully working countdown timer working but looks horrendous!
Being new to raw javascript, intervals and times this was not the easiest script to come up with, and thus, although it seems to be working as I want it too the code looks very clunky.
The timer ...
2
votes
1answer
53 views
Pi to the Nth Digit
I'm trying to teach myself Objective-C/Cocoa for eventual iPhone development but I figured I would start with a terminal app. It takes a user input, strips everything but numerics, then displays PI to ...
2
votes
1answer
92 views
How to optimize the following code in order to decrease the execution time?
I'm dealing with huge amount of data. I've written following code into a function to find out similar questions. It's working perfectly but it is taking too much time in execution. Can anyone help me ...
3
votes
2answers
113 views
Basic Querying on Python 2D arrays
Background
(TL;DR: This part can be skipped)
Today at work, I had to bring a component that used to load CSV data into MySQL, and perform calculations as result of SQL queries. I was tasked with ...
5
votes
1answer
266 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 performance. I guess there is a too much usage of maps in here, but I don't ...
3
votes
1answer
39 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
82 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
179 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
182 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
85 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
66 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
77 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
102 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
92 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
157 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 ...
3
votes
3answers
139 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 ...
6
votes
2answers
176 views
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
62 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
108 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
77 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
121 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
435 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
164 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 ...
2
votes
1answer
63 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 ...
7
votes
1answer
136 views
First jQuery Plugin - SmoothSlider
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
83 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
91 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
104 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 ...
2
votes
1answer
83 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
74 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
86 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
42 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
25 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 ...
-1
votes
1answer
40 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
71 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 = ...
4
votes
1answer
198 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
91 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
141 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
83 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
103 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
107 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
118 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 ...