Code Review Weekly Newsletter

Code Review newsletter

Top new questions this week:

Blackjack Strategy

I am creating a Blackjack simulator in Java in order to better understand the language. I have written the basic strategy section for a player and it is terribly long. Is there a better way to do …

java beginner game playing-cards  
asked by user2926358 16 votes
answered by Pimgd 14 votes

Python - Minesweeper

I'm new to Python (and generally to programming), and I have recently written this Minesweeper game: import random import string import os class Square(object): """Represent a square in the cell. …

python beginner game python-2.7  
asked by ThatBoredPenguin 14 votes
answered by mleyfman 2 votes

Check a string to see if it is a palindrome

I have written two code pieces of to find if a given string is a palindrome: public static bool FirstMethod(string str) { int i = 0; int j = str.Length - 1; while (i<j) { …

c# palindrome comparative-review  
asked by kyle 13 votes
answered by ckuhn203 17 votes

Simple random number generator

I have been wanting to learn programming for some time now and decided to really give it a shot today. I have edited and read lots of things in Java to fix small issues but never written from scratch. …

python beginner python-2.7 random  
asked by Dzzs 13 votes
answered by paritosh 11 votes

How is my CMS design? Any security, design, or other issues?

I am trying to learn PHP in depth by creating this personal CMS. I try to utilize OOP concepts and do best I can... The way I am trying to design this CMS is to keep including 'modules' within a page …

php oop design-patterns security  
asked by HelpNeeder 13 votes
answered by shudder 8 votes

A flashing ! exclamation ! point ! bar

I have this Objective-C code for use in an iOS app that makes a 'bar' on the screen, with a red exclamation mark that flashes in it at random places. Here's what it looks like: Header file: …

objective-c ios animation graphics  
asked by Undo 12 votes
answered by bazola 12 votes

Unit Testing for isPrime function

I've decided that I want to take a stab at test first programming. So, before I tackled writing an isPrime function, I wrote this unit test. It's my first and I'm not sure I'm doing this right. I was …

c# unit-testing primes  
asked by ckuhn203 12 votes
answered by mjolka 8 votes

Greatest hits from previous weeks:

Remove-Last-Comma-Problem

is there a more elegant way to solve this problem? List<String> paramList = new ArrayList<String>( ); paramList.add( "param1" ); paramList.add( "param2" ); StringBuilder result = new …

java strings  
asked by Jonas 58 votes
answered by Adeel Zafar Soomro 56 votes

Why is my C# program slower than my Python program?

I made a program in Python and wanted it to be faster, so I wrote it on C# because it's compiled. To my surprise, the Python program is much faster. I guess there is something wrong with my C# code, …

c# python optimization performance  
asked by bobpal 17 votes
answered by Mat's Mug 17 votes

Can you answer these?

Factorial using trampolines

I've translated this Java code into Delphi code: unit Trampoline; interface type ITrampoline<T> = interface function Get: T; function Run: ITrampoline<T>; function …

optimization recursion delphi  
asked by Johan 3 votes

C++ Wrapper for SAFEARRAY

Here is a C++ wrapper for SAFEARRAY, including the ability to expose it as a VARIANT, and to create one out of VARIANT. I am aware of CComSafeArray, however i don't use VC++ so I do not have …

c++ com  
asked by Matt McNabb 2 votes

Brainfuck interpreter in JavaScript, take 2

The previous version is here. This version takes suggestions from that review into account: brainfuck is now an object instead of a function, and brainfuck.run(source) kicks off the interpreter. …

javascript brainfuck interpreter  
asked by Dagg 7 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