A coding style is a set of conventions and practices used in software, such as naming classes, variables, and files.

learn more… | top users | synonyms

4
votes
1answer
28 views

Bash script to convert NIST vectors to debug scripts

TL;DR: The Bash script (below) is converting a published, somewhat-structured text file into a format usable by my testing infrastructure. It's slow, I think it's ugly -- although it is fully ...
1
vote
0answers
32 views

Improving a system calculator application

I want to make sure that the code is correct in terms of its design, code correctness, best practices & Junit testing. The complete description is given below: **Functioning of the app quickly ...
5
votes
1answer
26 views

Binary converter and sufficient tests

I just finished writing a basic binary conversion class in Ruby. I'm curious to see if anyone has suggestions for improvements. In particular, I'm looking for the cleanest, shortest, most succinct ...
1
vote
1answer
22 views

Manage XML file with custom XmlFileHandler class

This post is a follow up question. The purpose of this class should became clear without any further explanation. Raise your hand. If not, then I will have to improve the naming/structure. I would ...
1
vote
1answer
25 views

Dynamically loading jQuery when it's not available or version isn't high enough

I'm writing a script for others to use on their websites. I'd like to use jQuery in this script. Because I don't have control over what frameworks people use on their sites, I need to make sure jQuery ...
3
votes
1answer
26 views

Cleaning up repeated calls to NSMakeRange()

In Objective-C, many of the NSString or NSMutableString methods for comparing or manipulating strings require a range argument--that is, an argument of data type ...
6
votes
1answer
61 views

Reading data from excel sheet with ExcelDataReader

Objective: I want to import an excel file, and read the rows of certain columns. For this, I use ExcelDataReader. I implemented a low-level class called ExcelData which uses the ExcelDataReader and ...
8
votes
4answers
97 views

Check if XmlNode with certain attribute exists and create XmlNode if not

I'm not going to explain the purpose of the code provided below. If you do not understand it, i know that i have to improve it (naming, structure etc.). I would like to know how to improve this code ...
3
votes
1answer
46 views

Flat-file DB with CRUD

I just finished writing a flat-file DB class for PHP which supports selecting, updating, inserting and deleting. I was wondering if there are any ways to make it faster or if I'm doing anything the ...
6
votes
3answers
107 views

IDisposable Interface for an Server/Client connection client

Here is a class of one of my applications I'm trying to learn writing good code with. Old Code: ...
17
votes
6answers
621 views

A Library Class : Point

I am trying to create a library of my own which contains (among others), a class called Point. As the name suggests, it is intended to encapsulate a point ...
2
votes
1answer
105 views

How should I name a mapper or manager?

Recently I was reading a book called Clean Code by Robert C. Martin. There is a chapter called Meaningful Names that started me thinking if I was doing this right. I know there isn't one good way to ...
4
votes
2answers
97 views

How many squares can you see?

With a positive outlook, I posted this challenge at Programming Puzzles & Code Golf. I tried to come up with my own solution to the challenge which is as follows: The output is displayed (not ...
3
votes
1answer
166 views

My first controller rspec test

I'm just started learning TDD with Rails and RSpec. This is my first test for controller. Just plain RESTful UserController that responds with JSON, so it has no new and edit methods. Please review it ...
1
vote
0answers
13 views

How can I clean up this hack to scrape paths from a Gruntfile?

As a part of my Tabv Vim plugin (which at this stage is nothing more than a pitiful rag-tag assortment of half-baked hacks), I have a function which attempts to guess the directory paths for main ...
9
votes
1answer
106 views

Console command tool

I have created a little console tool that simply does commands that you enter. The commands are stored in a txt file. Right now I only got 2 commands: getTime and ...
7
votes
1answer
60 views

Android close running apps

I have developed a service to automatically detect whether an app has started. If the user forbid this app to start (could be chosen from a list of apps), a dialog will be shown. ...
4
votes
2answers
84 views

Better PHP Ajax Request Processing Structure

I have a server side PHP file which processes Ajax requests from the client browser. Some requests are only valid if they originate from an Administrator in the application, others are only valid if ...
1
vote
0answers
35 views

Split large import task into smaller subtasks

I have a large import task that runs as a cronjob and I want to split that task in smaller subtasks. Each subtask should be handled by an own class. At the cronjob entry point I prepare the ...
15
votes
6answers
595 views

Print out table with start/end temperatures and step size

I am trying to learn C++ by myself. I looked up a sample question after going through some text. Though I would like someone to review my code. I'm basically asking you to break it to show some flaws ...
6
votes
2answers
81 views

Clean, efficient and extensible code for querying collections

I recently wrote code that would query a collection of objects and rank them according to a given criteria and then filter based on an object property. I attach the code below. I would like to know if ...
9
votes
2answers
97 views

Optimizing “simplifier”

Basically, I'm trying to make a Simplifier that can take inputs in the form of a String and print out the solution step-by-step. Now that I've got it working, I ...
5
votes
3answers
142 views

Adding two BigIntegers by putting mutiple digits in a linked list

Based on feedback on an earlier question, I decided to implement the addition of two big ints by putting multiple digits in a node of a linked list. Can somebody take a look at my code and let me know ...
10
votes
5answers
458 views

Optimizing boolean checking method

I have written a method that checks if n number of true booleans are present in a ...
1
vote
1answer
50 views

Script scraper for outputting variables and functions to a text file

I've been programming with Python 2.7 for about six months now and if possible, I'd like some critique to see what I might have done better or what I might be doing wrong. My objective was to make a ...
5
votes
2answers
123 views

Adding two BigInts using linked lists in C

While trying to learn more about linked lists, I thought I should try the exercise of reading two BigInts from an input file and then adding them up. My strategy was to store the two numbers in two ...
5
votes
2answers
178 views

General practitioner collection

The following code is used to find the usual_gp(General Practitioner) from gpCollection variable of type TreeMap<Long(Date), ...
40
votes
7answers
6k views

'100' is a magic number

Magic numbers are bad. I totally agree. But there's a magic number I find hard to fix: '100' is a magic number. Consider this code: ...
5
votes
1answer
75 views

Linked List implementation and manipulations in C

While trying to learn some more C, I decided to implement a linked list and perform a few operations on it. The first thing I wanted to do was read from a .csv of numbers (ex: 1,2,3,...) and store ...
10
votes
3answers
185 views

RPSLS is less messy now, but is it clean?

This is a follow up to the following questions: RPSLS Game in C# Is my coding technique progressing in terms of C# loops? I haven't made my way to DecideWinner() ...
4
votes
4answers
588 views

Make LinkedList in C++ more clean

I have been working on a linked list for some while now and started out with this. Is my code clean? Or is there some way to make it better and more readable? The reason for this question is for me ...
6
votes
1answer
75 views

Finite Automaton for a Typing Game

I'm creating a game that implements a finite automaton and I don't know if I'm doing it right. Any advice? Game class ...
10
votes
3answers
275 views

Proper capitalization for book titles?

I'm working through some exercises to sharpen my Ruby skills. The following code is how I solved this particular question. I'd like to know what other developers think of this solution. I'm self ...
7
votes
1answer
56 views

Importing data from an external EXCEL-Sheet

I was assigned the task of copying some subsums from a given EXCEL-Sheet into the executing EXCEL-Sheet. This had to be done with an EXCEL-Macro, so non-programmers can easily use it. There was the ...
10
votes
4answers
647 views

Lexical Analyzer: Is this the right way?

I'm doing a lexical analyzer for my programming language and I don't know if I'm doing it right. Can anyone can help me with this or suggest a better way of doing it? ...
7
votes
1answer
133 views

Tokenizing string using strtok

In this assignment, I'm supposed to split a string using strtok. (The assignment consists of the comment and the function definition; I fill in the function body.) ...
1
vote
2answers
70 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 ...
3
votes
1answer
170 views

Call to external web service

The architecture is showing a call to an external Web Service which is called by me. Then I will expose the data using WCF to be callable from another WCF client. But I really don't like how it's ...
6
votes
4answers
760 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 ...
2
votes
2answers
73 views

How to declutter dependencies?

I'm running into a problem with my code in a ASP.NET MVC application. Maybe it's not a problem and I'm just being paranoid, but it seems like a problem to me (might be because I've just read the book ...
5
votes
1answer
95 views

JavaScript Sandbox Pattern

Based on this Stack Overflow question I came up with the following code. I'd like your general thoughts about it. Code style, functional, logical, disadvantages, just anything you can come up based ...
4
votes
1answer
102 views

How can I improve this AVCaptureMetadataOutputObjects wrapper?

With iOS7, Apple introduced AVCaptureMetadataOutputObjects, which is used for scanning barcodes. If you check out the web for how to scan barcodes in iOS, almost ...
5
votes
1answer
79 views

How can I condense several IBAction methods in a class with a delegate?

I have the following class: MyProtocolClass.h ...
7
votes
4answers
57 views

What is the best way to refactor out “temporal dependence” of instance methods?

For example, suppose in a view class we need to instantiate some UI components and then populate the fields. Something like: ...
-1
votes
1answer
83 views

Is multiple return statements bad practice? [closed]

When learning computer science at university, I was told to only have one return statement in a method, and use a retval variable where necessary like this: ...
10
votes
3answers
167 views

Counting words / lines in Ruby - more compact / idiomatic way?

I solved this problem in Ruby: Write an utility that takes 3 command-line parameters P1, P2 and P3. P3 is OPTIONAL (see below) P1 is always a file path/name. P2 can take the values: ...
1
vote
0answers
47 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: ...
2
votes
1answer
76 views

Refactor ConvertorToString class

Help me refactor this class that helps to represent an object state as String: ...
2
votes
2answers
80 views

How to name this very simple class?

I want to give a short and clear name to this class: ...
3
votes
2answers
81 views

One-file script that detects changes in file-systems via polling and Pythonic idiomatic-ness

This is a (relatively) cleaned-up version of a Python script I've been working on for the past day or two based on Tim Golden's first solution to the above problem. I know about watchdog but I'm ...