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

learn more… | top users | synonyms

0
votes
0answers
20 views

When to use python function nesting? [on hold]

I am writing a program that creates backup of directories. Which of the following approach is better for code organization? Create separate class for Backup and Zip logic - class BackupUtil: ...
2
votes
0answers
24 views

Domain modelling with Repository [on hold]

I've been struggling with some architectural problems which I'm having a hard time figuring out myself. Im trying to construct a basic structure of a project with the domain model and repository ...
9
votes
2answers
85 views

How can this Ruby format analyser be improved?

I have a requirement to validate file names related to architecture after they are uploaded. Once they have been uploaded I must warn the user if the file name is not standards compliant. What's in a ...
6
votes
2answers
60 views

Android Thread and Runnable

This is my code for running a background thread. I believe it is very poor in naming and code structure. package com.ocs.socialshare.bloggershare; import android.app.Activity; import ...
4
votes
1answer
54 views

Resource manager implementation, with resources being organized in a scope-like hierarchy

The original question where the general concept of this implementation was discussed: Using ID's with a "scope" -like hierarchy I have designed a resource manager as part of a game ...
6
votes
5answers
1k views

Movement code from a game

Could you suggest ways of writing this code better? bool success = true; if(x == 0) { if(do_up) run_do_up(); else if(do_a) run_do_a(); else if(do_n) run_do_n(); ...
2
votes
0answers
32 views

PHP framework building: Sessions Managment Class

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 ...
3
votes
1answer
42 views

Determine local maximum from given points

How could I make this code more effective? I'm just experimenting and learning the different ways of how Python runs. list=[] original=mkPoint3D(x,y) z1=mkPoint3D(x-d,y) z2=mkPoint3D(x+d,y) ...
5
votes
2answers
59 views

Is it advisable to integrate SQL statements in the JSP pages that are not displayed to the user but handled at the back?

I have a signup form in which the user has to enter the email address and after some quick asynchronous processing at the backend I have to tell the user that whether the email address is already ...
0
votes
0answers
30 views

Prototype OO-style of my THREE.JS application in JavaScript

For several months I'm working with JavaScript and THREE.JS library. Firstly I dislike the prototype-based programming, because I have to work a lot of with class-oriented languages, where any class ...
1
vote
2answers
54 views

Same function but use different array data

I have these two carousels that randomly pick up pictures. [fiddle] Each of them picks up pictures and links from their own different inner array. It works fine as it is, but I was just wondering if ...
6
votes
4answers
721 views

Making a word processor

The Word Processor I had in mind would be similar to Microsoft's word and OpenOffice. I am trying to keep my logic separated from the User Interface and that separated from the controller, basically ...
5
votes
2answers
178 views

Optimization of file scanner

Program must to find duplicate files (by content) in a given directory(and subdirectories). I collect all data in Map<Long, ArrayList<String>> map where Key is the size of file and Value ...
1
vote
0answers
24 views

Inheritance and setting up for an API request

I am setting up a class to be used for an API request (with JavaScriptSerializer) I am using it to send a complaint to their ticketing systems. So for example I send Title, Description, Custom_Fields ...
5
votes
1answer
92 views

Using ID's with a “scope” -like hierarchy

I currently have a ResourceManager class which is responsible for searching for resources with a given identifier, returning a reference counted pointer to the resource if a valid resource is found, ...
4
votes
1answer
85 views

Abstract Person with Employees and Clients

I have a interface with the following implementation public abstract class PersonInterface { public abstract void Update(PersonModel person); public abstract void Delete(int id); ...
1
vote
0answers
42 views

Class factory of virtual functions and delegates [closed]

I'm planning to make a factory of virtual functions and delegates on a separate class like this: class swcVFunctionAndDelegates { typedef std::function<void ()> Delegates; public: Delegates ...
4
votes
2answers
88 views

Optimising LinkedList class - Part 2

This is part 2. My problems are with too any pointers and with long body code in the following functions: void push_back(T_ data); void push_front(T_ data); T_ pop_back(); T_ pop_front(); void ...
9
votes
1answer
59 views

Shortcuts and imports for large RPG basic code

I decided to work on putting together an Arena-style (very basic) text-based RPG as a way to help myself learn Python. Unfortunately, after about 1,000 lines of pieced-together code, I realize that ...
4
votes
1answer
62 views

Radio ListView onCheckedChangeListener?

This is my adapter class, to create a custom listView with three radiobuttons: public class Attendancelist_customadapter extends ArrayAdapter { ///needs two arraylists - one for the ...
10
votes
3answers
170 views

MS Excel type of grid in jQuery

I have created a MS Excel type of grid in jQuery. I want to learn best practices and I need your comments for more optimized code. Please review the code and offer your suggestions. Demo jQuery: ...
9
votes
2answers
138 views

Handling null arguments in a factory class

I have a Factory class that gives out instances of ResponseImpl class. It accepts one Destination class and up to four Source classes. At least one of the four Source classes should be not null. So, ...
10
votes
2answers
160 views

Knockout.js binding 2D table with rowspan

The app I'm working on should allows it's users to create tables. I have a view in which users are able to create a table. They should be able to define here the table's columns. The columns that the ...
7
votes
4answers
166 views

Boolean expression complexity and bitwise operators

Given this kind of code: public static final int DEFAULT_MASK = Mask.BASE | Mask.SECTOR | Mask.GROUP | Mask.INDUSTRY | Mask.NAME | Mask.COUNTRY; Sonar raises a warning: ...
8
votes
1answer
68 views

Graphical game application

I'm writing my first JavaScript application (no 3rd party libraries used) and looking for some high-level guidance on how to better organize the code into separate classes & files. Here is a ...
-1
votes
1answer
79 views

Which code looks better? [closed]

I've got a question on what code style is better. There are two arrays containing some codes. One array consists of string elements, the other consists of integer elements. The corresponding values ...
8
votes
3answers
118 views

How clear is this ruby code?

Elsewhere, there was a question about an elegant solution to a problem. I'm curious whether this solution is elegant from the perspective of easy to understand for a ruby programmer (which I am no ...
5
votes
1answer
134 views

Improvements on Python game?

This is a game I made in Python. While it is not my first, I am not happy with the result. I would like suggestions on ways I can make it better, more user-friendly, and more enjoyable. Also, if ...
8
votes
2answers
207 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
98 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 ...
3
votes
4answers
99 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
43 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
68 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
79 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
126 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
207 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
267 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
69 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
101 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
202 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
351 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
65 views

Backtracking Project [closed]

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
86 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
190 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
1k 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
88 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
73 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 ...
2
votes
1answer
119 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
133 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
115 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: ...