Best-practice questions generally involve a short excerpt of code with a question of general interest, usually focused more on maintainability concerns than the algorithm to solve the task at hand. Note that questions must include a real code excerpt and sufficient context for reviewers to make ...

learn more… | top users | synonyms

6
votes
4answers
263 views

An enum that has situationally invalid entries

Is it considered bad style to have that BOTH value in the Direction enum? Problems can arise from ...
0
votes
0answers
29 views

Advanced programming Advice to separate code for classes? [on hold]

Quick question, Now further in my career I have found that I am still sticking with some of my bad coding techniques, such as Coding directly into the Event (such as the _ButtonClick event), instead ...
0
votes
3answers
56 views

Call method from another method and into the cycle [on hold]

Is this normal or do you have more best practices? ...
4
votes
0answers
173 views

Multithreaded file downloader using threading and signals

This is my first attempt to write a multithreaded application that downloads files from internet. I am looking for improvement in code, logic and better strategy for implementation. Please ignore the ...
0
votes
0answers
22 views

Code Example to illustrate how to Limit a class's dependencies (entities that depend on a class) [on hold]

I was referring to best practices article on the guides repository which is maintained by Thoughtbot. One of their best practices under Object Oriented Design says - Limit an object's ...
8
votes
2answers
353 views

Swing calculator - first GUI program

I've recently made a calculator using Java and Swing. I'm okay with the results but I'm curious what are the major flaws I've made (assuming there are, because it is my first program making GUI). I ...
3
votes
1answer
45 views

Base class for subclasses that can track their own instances

I'm new to Python, with some background in Java and C# from a while ago, and more recently in scripting worlds like Bash and AppleScript. I wanted to be able to create classes that could report ...
2
votes
1answer
94 views

Checking if variable is defined before accessing its properties [closed]

I didn't write this but I noticed it in our codebase at work. ...
-2
votes
0answers
33 views

Setup Code Reviews for TFS & JIRA? [closed]

I was going to ask this in StackOverflow but I had a feeling they were going to stone me to death and throw my battered body over here so I figured I would ask here first. We are using TFS as our ...
2
votes
1answer
36 views

Writing my own jQuery plugin

I am trying to write a jQuery Plugin from a piece of JS code I had written. What this plugin does is it converts a select box into a map of Australia where I can select individual states. It's ...
3
votes
1answer
44 views

Rebol Function to Categorize Items in a Block

I have a function that iterates through a block, tests each value against a given function and is placed in a block associated with the product of that function. ...
8
votes
4answers
466 views

Is this an efficient use of a boolean method?

This is sort of a follow up to a previous question (Do I have any SQL leaks?). I have changed some things around and am working on a solution where I use Active Directory to gather information about ...
3
votes
2answers
57 views

Initializing variable outside loop [closed]

Is this good practice? int a; while(true) { a = foo(); // a is only used in this loop not outside of it // some more code ... } Or should the variable ...
1
vote
0answers
37 views

JavaScript parameters - best practices for settings object/callback

I have the following function which runs as expected and is defined in the window object: ...
5
votes
1answer
39 views

Test if Excel is open without relying on catching an error

Getting a hook on an open instance of Excel is something I do all the time. I'm now questioning if I'm doing this the best way. I'm particularly concerned with the fact that I rely on the ...
0
votes
1answer
37 views

Factory Pattern to Abstract Factory Pattern [closed]

My Product Factory public interface IProdctFactory { void Drive(int miles); } My Vehicle Factory ...
1
vote
0answers
16 views

Intern AuditSystem in DB and getting users from it

Mine project has a change on the database, so that every INSERT-UPDATE-DELETE action is logged with triggers on the DB. For that they have an extra table created : Table ...
4
votes
1answer
79 views

Is using a switch case as a form of structured goto considered good practice?

I have this JavaScript excerpt, and I was wondering if this (primarily the usage of switch case) would be considered good practice. One item of note is that I have it separated into two similar parts ...
2
votes
2answers
68 views

Using global variables in my node.js program configuration

I know using global variables in JavaScript is bad practice. Here I am using config, host and port as global variables as I have added a watch function to watch for the changes in the config.json ...
0
votes
2answers
51 views

Simple GUI using tabs to separate application windows

I'm designing a simple GUI using tabs to separate each 'window' of the application. There are 3 main tabs, each with 2 sub-tabs. In one class I create the entire hierarchy of panes and panels: ...
2
votes
3answers
120 views

Employee wage/salary calculation MVP solution

In this project (C# Win forms) I'm supposed to calculate wages of employees. These are the steps: Calculate earnings from Attendance data. Here all regular earnings like ...
9
votes
1answer
116 views

Responsive Foundation Orbit Image Gallery

I decided to refactor the code for a responsive image gallery, that I setup not too long ago. Following the suggestions @joseph-the-dreamer made, and some other best practices, I cut down on the ...
5
votes
3answers
259 views

Multiple background tasks

This is taken from my post at Stack Overflow here. I need your help to review my code for improvement and best practice. ...
6
votes
2answers
156 views

How to Make Strongly-typed References to Web.Config?

Let's say I have a configuration file with a property in it: <add key="LoadedCode" value="L" /> I know I can reference this using the ConfigurationManager: ...
8
votes
2answers
319 views

3 tier architecture ado.net application

I would like to develop a student management system with repository pattern using ado.net (no EF or MVC). I decided to create the model (business objects) and interfaces as one project ...
12
votes
3answers
275 views

Calculate balance wages

In the following code I'm trying to calculate Net Wage of employees and classes Earning, Deduction and ...
2
votes
1answer
41 views

Neo4J Rest Javascript wrapper

As a toy project, I started evaluating the Neo4J graph database and its Rest interface. I'm drying to write a simple graph visualization in Javascript. In daily business I'm a Java developer and maybe ...
2
votes
2answers
72 views

Simple Data Access Layer

I have DatabaseContext class. ...
3
votes
0answers
34 views

Most intuitive way to register “commands” in an extensible IRC bot in Go

I'm writing an IRC bot as a toy project, and one of the goals is to be easy and straight-forward to implement and register new commands. As I'm new to Go, I don't know which would be the "Go way" for ...
4
votes
2answers
156 views

Still pulling information from XML to insert into Word Document inside 3rd party application

Follow up to This Question I took some very good advice and changed my code around a little bit and eliminated some If statements. I am not retrieving very much ...
2
votes
1answer
57 views

Guild Wars: Knights & Dragons - Version 2

I have changed a lot from my original code that I posted about a week ago, you can see that here: Guild Wars: Knights & Dragons Now what I need to know is if I improve this code further. Any ...
5
votes
4answers
405 views

Sending GET/POST requests in .NET

I have a RequestsExtensions class with two functions for sending GET/POST requests. ...
10
votes
3answers
289 views

ASP.Net caching manager

I have a Cache Helper Class. ...
7
votes
1answer
183 views

User defined string literals and namespace use

I have a need to process URIs in one of my applications, sometimes from const char[] literals. My API: ...
5
votes
1answer
122 views

Calculating Earnings from attendance details

In a C# win forms payroll application I need to calculate employee salary based on their attendance. I've written a stored procedure which calculates earnings of all employees from the data available ...
3
votes
3answers
208 views

Guild Wars: Knights & Dragons

I want to improve this code to make it look more professional, be loaded quicker and make it cross-browser compatible. Do note that it is not a finished site. I want to know the best practice for ...
7
votes
2answers
508 views

How random is this password-generating algorithm?

This code's sole purpose is to create a very random password, using letters and numbers. I think that it fulfills its purpose, but I wonder, could it be done better? I'm not talking about ...
0
votes
2answers
45 views
1
vote
2answers
101 views

Classes for Facebook graph API and Twitter access

Given below is code which I wrote to provide an easy access to Facebook graph API. ...
6
votes
1answer
196 views

Python Back-Up Script

I wrote this script to backup some important files. It backs up the files to a local folder as well as to an external hard drive. It creates a new subdirectory which has its name constructed with ...
2
votes
1answer
54 views

Inline script routine for Open Sesame experiment

I am new to Python as well as threading and had to build an inline script routine for the use within a Open Sesame Experiment. The Routine should open a program, play tones and catch reaction times. ...
0
votes
1answer
39 views

best practice in use of if statement followed by another [closed]

suppose I need to use loop statement just after the if condition as bellow, if(true){ foreach ($arr as $value) { echo $value ; } } and also i can ...
4
votes
0answers
133 views

Is this a correct way to preload images/stop loading images? [closed]

I have a site that displays 1 animated GIF, where the source is assigned by a variable: image_url[current_url]. When a user clicks next, this image is replaced by ...
10
votes
2answers
102 views

“Event Binding” in Java employing Lambda

As I am relativistically new to programming and lack any sort of formal experience in the matter, I was wondering if any of you with a bit more knowledge in the subject would be willing to tell me if ...
1
vote
1answer
61 views

Key and value mapping from one object to another

I've been trying to figure out a clean way of managing mappings between two objects. In the case of this example, it's two hashes. This spec should illustrate the problem at hand: ...
0
votes
0answers
58 views

Unit of Work with Generic Repository Pattern MVVM, vol. 4

Continuation of this question: Unit of Work with Generic Repository Pattern MVVM, vol. 3 I have made some changes. The methods GetFeedBySomething() have been ...
4
votes
3answers
322 views

How do I avoid over-using the garbage collector?

I'm wondering what the best way of initializing variables so that I don't over use the garbage collector with a for-loop. Assuming the variable is only used inside ...
3
votes
2answers
65 views

Is this following Separation of Concerns and PHP OOP standards?

I've been working with PHP for a while now, but unfortunately haven't delved into the OO side of it until recently. I've been reading up on separation of concerns and OOP best practices, and I think ...
11
votes
4answers
454 views

File editing program

I have written a Java class to replace text in file. The file contains database configurations and is as follows: ...
3
votes
3answers
86 views

Wrote a package in Go. What did I do wrong? What did I do right?

I wrote a Player package in Go. It builds correctly, but I would love a review on what I did and did not do "the Go way". I'm new to coding in the language, although I've gotten about halfway through ...