Code Review Weekly Newsletter

Code Review newsletter

Top new questions this week:

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 …

c++ beginner clean-code code-organization  
asked by Dexobox 15 votes
answered by 200_success 10 votes

Just a lowly counter that turned out to be surprisingly complicated

While writing this review, I saw a need for a Counter object similar to Python's. It seemed like it would be easy to write such a class, but it turned out to be surprisingly complicated. …

java unit-testing collections null junit  
asked by 200_success 15 votes
answered by bowmore 13 votes

Logging without Code Bloat

I was wondering if any of you new any best practices or design patterns so that I can have good logging in my programs without them looking messy or bloated. I am currently using C# and NLog however …

c# logging  
asked by Pete Petersen 14 votes
answered by Bill Michell 18 votes

How do I avoid deep nesting in this Python code?

Unlike Perl, you can't to my knowledge match a regular expression inside an if statement in Python and assign the result to a varaible at the same moment. This leads to typical constructs like this: …

python  
asked by Thor 12 votes
answered by Calpratt 11 votes

Making additional subclasses at any time should be as painless as possible

I'm writing a small text-based game in Java to learn the language. I'm concerned that I may be making some poor design decisions. I'll introduce 2 elements: A character and monsters. A singleton …

java game  
asked by user2651804 12 votes
answered by rolfl 7 votes

Java 8 Effective Use of Multiple Streams

I am experimenting with streams and lambdas in Java 8. This is my first serious foray using functional programming concepts; I'd like a critique on this code. This code finds the Cartesian product of …

java functional-programming style stream lambda  
asked by MonkeyWithDarts 11 votes
answered by rolfl 11 votes

Write a function to find the first non-repeated character in a string

Here is a practice question I am solving: Write a function to find the first non-repeated character in a string. For instance, the first non-repeated character in 'total' is 'o' and the first …

javascript algorithm strings  
asked by HelloWorld 10 votes
answered by konijn 7 votes

Greatest hits from previous weeks:

C# Console Chat Server - Async/Await, TcpClient/TcpListener, NetworkStream (async)

Just looking for feedback on correctness of my understanding of async/await. Curious about the Task.Run inside of the StartReceive() method. Resharper (or maybe just the compiler) warns against …

c# task-parallel-library socket async-await tcp  
asked by jeremywho 5 votes
answered by Stephen Cleary 5 votes

Snake game -- made with Python

I wrote a simple Python snake game, it's about 250 lines of code. Can someone give me some advice on how to refactor/make it better? game.py # game.py - 3/22/2013 import pygame, sys, os from …

python array pygame  
asked by Ryan 4 votes
answered by Gareth Rees 5 votes

Can you answer these?

jQuery Load More Plugin

This is a simple load more plugin, built for teaching purposes. For this reason, it's not pretty in terms of output. I'd like to know if this can be improved, or if anyone can spot any major problems …

javascript php jquery reinventing-the-wheel  
asked by Alex Garrett 3 votes

NSInvocation Implementation

I'm using NSInvocation as a choke point in my app to help manage threading and reduce the amount of redundant code. The purpose of this class is to pass arguments from the view controllers to the API …

multithreading objective-c ios  
asked by JeffCompton 5 votes

Preloading images in JavaScript

I'm working on a little game where you press a button and a new image appears. There's a glitch every time you ask a new image to display and it occurred to me that I should preload the necessary …

javascript beginner image  
asked by lindsey 4 votes
Subscribe to more Stack Exchange newsletters


Unsubscribe from this newsletter or change your email preferences by visiting your subscriptions page on stackexchange.com.

Questions? Comments? Let us know on our feedback site. If you no longer want to receive mail from Stack Exchange, unsubscribe from all stackexchange.com emails.

Stack Exchange, Inc. 110 William St, 28th Floor, NY NY 10038 <3