@Mat'sMug Just because a review focuses on high-level architecture stuff doesn't mean that it's necessarily belong on Programmers, does it? I mean... as long as a question provides actual working code and that code wants feedback, it's CR. Doesn't matter if it's about reviewing formatting and stuff, or reviewing higher-level design, does it?
@davidkennedy85 About decoupling, I'd say that the most important thing is to decouple your model from your view. For example, I'm making a game and I'd want to make that game for both Android and Java Swing and Google Web Toolkit, so it's important that I don't couple my game logic code to my Android views.
Hmmm ... I would agree.... except for the fact it has a lot of code.... You just happened to focus mostly on the design in your review (because that is what struck you as most significant).
@SimonAndréForsberg it's fine, because there's code to review - if it were just the high-level stuff, then I'd flag for migration. Instead I posted an answer ;)
@davidkennedy85 To make the decoupling, you can use interfaces. Let the game model receive some kind of callback interface for when it's game state is changing, in which case the view should update. (The view is what implements the callback interface). It's OK for the view to know about the model, but the model should not know about the view -- all the model can know is that it has an interface to report "events" too. (I have to admit I haven't looked at your question though)
I am one reputation point from tying my Stack Overflow reputation, 2 points away from my Code Review account being my highest rep account on Stack Exchange.
This javascript code should me a rectangle around the screen with the arrow keys. It is not doing that and I am not certain as to why that is the case. Is there something that I have missed that has to happen on the onload of the body.
I am not certain as to way this is not working.
Code:
<html>...
The following PHP does exactly what I need it to do but, as a complete PHP novice, I am wondering what can be improved here?
$theurl='./section-1.html';
function getbody1($filename) {
$file = file_get_contents($filename);
$bodypattern = ".*";
$bodyendpattern = ".*";
$thecontainer = "id=\...
C# has major differences between versions, and yet there's only one C# tag. When a question uses version-specifics, there's a tag for it: take linq, task-parallel-library and async-await as examples. — Mat's Mug8 secs ago
Recently the java-8 tag was created to apply to Java8 specific questions.
There is no doubt that the questions are, in fact, Java8 questions. The meta question though, is:
Should java-8 exist, and if it should, what should it be, a full tag, or a synonym to java?
NO, it shouldn't exist, not even be a synonym!
c# has major differences between versions, too. And yet, the only C# tag we have is c#. How do we address this?
C# 2.0 introduced generics. Enter the generics tag.
C# 3.0 introduced linq. Enter the linq tag.
C# 4.0 introduced the Task Parallel Li...
Regarding the CW, I can lift the status myself, but I would have to determine if the situation warrants lifting it. I shouldn't do it for everyone. For instance, one of my own questions turned CW, but I don't believe it warrants removal of the status (I'd prefer to have another mod remove it anway).
Some questions and answers are marked Community Wiki and are owned by a Community Wiki user.
Why have Community Wiki posts?
How do Community Wiki posts work?
How does a post become a Community Wiki post?
How can the Community Wiki status be removed from a post?
Return to FAQ Index
There's also a risk of it happening with an edit war, but I don't think I've seen a serious one here before. If that ever happens, a mod can lock the post to prevent further edits.
David ... here in the 2nd monitor, we kill zombies with ammo
If you have not heard, CodeReview was reviewed as part of it's beta-site status. The review was interesting.... and the community response was more interesting....
Writing nice comments like this one takes time, it'd be nice to have a little more... automatic way of doing it:
Welcome to Code Review! Unfortunately it seems like you have misunderstood the concept of our site. We don't fix non-working code, we improve code quality of already working code. We can help in making code more "beautiful". When you manage to fix your problem, you can come back here and edit your question with the fixed version and we can help you beautify it :) — Simon André Forsberg51 secs ago
Although writing the comments manually perhaps makes them more personal, more welcoming. I don't want to become a robot (no offense, @syb0rg), but a little help on the way wouldn't hurt.
No more re-typing the same comments over and over!
This script adds a little 'auto' link next to all comments boxes. When you click the link, you see a popup with 6 configurable auto-comments (canned responses), which you can easily click to insert.
This script was inspired by answers to thi...
I've implemented Excel's SUMIFS function in pandas using the following code. Is there a better—more Pythonic—implementation?
from pandas import Series, DataFrame
import pandas as pd
df = pd.read_csv('data.csv')
# pandas equivalent of Excel's SUMIFS function
df.groupby('PROJECT').sum().ix['A001']...
Like the chat room on the AI.SE private beta. Wasn't much that was said there. It was helpful when I asked a SE employer about the on-topicness of my question though, so that was nice.
@skiwi (DING!) Yes, it's just our little @StackExchange bot puppet we have here. It's normally quite nice. But slow. And it still won't give us notifications about new answers!
I work as a full-time programmer for a tiny little shop that builds doors & windows. Spend my days debugging the VB6 crap my predecessors have put together.
At first I didn't like very much my job, because of the gigantic code crap. Now I have sneaked in several important refactorings, and am writing a lot of entirely new parts that the project is quite enjoyable :)
@davidkennedy85 if you're waiting for a colleague, it's actually a SOLID & DI/IoC fail. You should be coding against interfaces, and if you did that... you wouldn't be waiting for some implementation ;)
I'm creating an application that allows an actor to import JPEG files. The system extracts metadata from the file including GPS coordinates, displays them on a map and inserts the import into a database using SQL. All these steps occur if the actor clicks a button labeled 'import'. Is this too mu...
Recently the java-8 tag was created to apply to Java8 specific questions.
There is no doubt that the questions are, in fact, Java8 questions. The meta question though, is:
Should java-8 exist, and if it should, what should it be, a full tag, or a synonym to java?
There is an error in the javadoc of Path docs.oracle.com/javase/7/docs/api/java/nio/file/… the return phrase should be true if this path ends with the given path; otherwise false. That copy paste error!
I'm programming an entity-based web crawler, where I need to collect webpages on different people. Right now I'm iterating through a List of EntityWebpageBundles (a class I created with a label field for the name of the entity and list field for the list of WebpageObjects associated with the enti...
Sadly, you're one of the only users below 500 rep who actually flags to close. It would be nice if more could do that, which could indicate further participation and understanding of the site.
Question Downvote Tooltip
Recently I downvoted a question that was just dumping code on reviewers without any effort to put readers in context or anything whatsoever. There's a tooltip on the downvote button that is very useful on most Stack Exchange Q&A sites:
Downvote tooltip
Howev...
Everybody has their reasons for up/down voting. I'll upvote a question that's nicely formatted and provides enough context for reviewers to ..review the code. I'll downvote a question that dumps code on reviewers without any further context.
Answers, well... I have a happy voting trigger reputation preceding me... (previous name was "lol.upvote" ;)
I also upvote a question that I answer (if I'm not out of votes!) - if I can answer it, it's because the OP was nice enough to give me something ...reviewable.
what... stackoverflow in maintenance, what must I do now :P just kidding
appereantly my code isn't too efficient, been running for 10 mins on max cpu already... for (int c = 0; c < 1000; c++) { for (int b = 0; b < c; b++) { for (int a = 0; a < b; a++) { triplets.add(new Triplet(a, b, c)); } } }
@skiwi - People will tend to upvote questins that: - are easy to follow - present the problem well - tickle their passion I downvote questions that: - the asker is 'demanding' rather than 'asking' - does not give any background
sorry if I'm not allowed to post this much code here...
public void run() {
List<Triplet> triplets = new ArrayList<>();
for (int c = 0; c < 1000; c++) {
for (int b = 0; b < c; b++) {
int a = 1000 - c - b;
if (0 <= a && a < b) {
triplets.add(new Triplet(a, b, c));
}
}
}
result = triplets.stream()
.filter(Triplet::isPythagorean)
.mapToInt(Triplet::product)
.max().getAsInt();
}
If you didn't know already, the Stack Exchange Data Explorer (SEDE) now includes Code Review and all public StackExchange beta sites.
Bookmark: http://data.stackexchange.com/codereview/queries
This is our most powerful available tool to tap into our site's data and fetch everything we need ...
I'm getting a LoaderLock was detected error, and I'm about to email our dear 3rd-party ERP supplier to tell'em that they F'd up and that their code is the reason for our deadlocking ;)
Interested in a review of this code, in particular the (hopefully monadic) bind. I actually put this to good use. It was a nice complement to Guava's Optional, and shorter than:
Optional.fromNullable(x).or(y);
And I threw in a bind method, which I think lifts it up into monad space.
One qu...
I've hacked together some code to read the content from a sequence of files:
let fileContents =
[ "filename1"; "filename2"; "etc" ]
|> Seq.map(fun file -> async {
use fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)
let data = Array.create(int fs...
Recently I needed to save session state in cookies, instead of server side. I looked around and didn't see anything similar, so I decided to write something to handle the encryption, decryption, and validation of the cookies. I wanted some opinions before/if I release it on packagist.
Any feed...
Hey guys I have a problem with this program for class. It's a Euclid Algorithm problem and I'm stumped on why I keep getting an output of 0 for the GCD. I'm not sure where the problem lies so I'm going to post the whole program code. Here is my code:
#include <iostream>
using namespace std;
int...