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

7
votes
3answers
323 views

Calculate final test score from a list of test results

Recently I have given an interview to a widely well-known technology firm. The first interview was general and it went well but they rejected based on some technical things. They did not mention it so ...
5
votes
1answer
54 views

Field class used by my trading card game

As many may know, I am developing a Trading Card Game for the Coding Challenge. I have just completed the Field class and have not used it in practice yet, so all ...
1
vote
1answer
26 views

Improving a Haskell FizzBuzz Solution

I wrote a solution to the popularized FizzBuzz problem in Haskell to see how a functional solution looks. I'm more or less happy with my solution, except for the definition of ...
5
votes
2answers
81 views

Creating a better NSLog

So, generally when I write iOS code, I will start with a lot of calls to NSLog, which is a macro that with print the string you send it to the console. There's a ...
1
vote
1answer
27 views

How could I have approached this responsive image gallery differently?

This gallery uses the Orbit gallery from the Foundation framework (version 3). I've set it up so that on smaller screens it appears as an accordion. It works just fine, but is there a more concise ...
1
vote
3answers
98 views

Does my input helper class look good?

I'm new to OOP PHP and I created a simple input helper class. And was wondering if it's good? Are my dependencies good? Also the reason I'm not throwing an exception with the get method is that I ...
1
vote
2answers
46 views

How to write factory classes or functions in JavaScript? [on hold]

I find that in Javascript there are many methods of creating an object so what would be the appropriate approach for constructing an object and why. ...
5
votes
2answers
83 views

Geometry table for use in regexes

I have been teaching myself Python 3. I watched a video on YouTube entitled "stop writing classes". The Gtable class doesn't even have an init function, so I can't help but wonder if I should have ...
12
votes
3answers
1k views

Printing 80 (or more) times the same character

I want to print a lot of the same characters and I don't want to use a for loop and I'm also looking for a way to do it as less lines as possible. Even better I would like to be able to store that ...
11
votes
3answers
379 views

Printing the most used words from phrases

I have a collection of phrases in a List. Each phrase is a String Array where each element in the array is a word. I create a ...
3
votes
1answer
41 views

Insertion Sort implementation in Java

I have implemented Insertion sort in Java. Please review it. ...
4
votes
3answers
122 views

Is my web site structured correctly?

I'm trying to get a better handle of code organization and how HTML5 (really HTML) stack works in general. I've worked mostly with ASP.NET Webforms and done some MVC as well. Let me say now, "I hate ...
6
votes
1answer
41 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 ...
6
votes
1answer
63 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
31 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
43 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 ...
4
votes
1answer
39 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
96 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
118 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
60 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
113 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
628 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
107 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
101 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
177 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
14 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
109 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
70 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
87 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
36 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 ...
16
votes
6answers
601 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
85 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
101 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
147 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
461 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
51 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
134 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), ...
41
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
193 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
598 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
288 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
61 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
664 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
147 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
73 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
205 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
775 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 ...