66 votes
Accepted

Easier user input in C++

namespace std Others have said this already but it's important enough to be repeated: Don't put your own definitions into ...
5gon12eder's user avatar
  • 4,260
11 votes

Easier user input in C++

namespace std is reserved. Don't add stuff to it. Especially since there's no reason to in this case. Just put it in your own namespace. unnecessary string usage ...
Barry's user avatar
  • 18.4k
11 votes

Easier user input in C++

I've actually implemented the same functionality in the past, so here are my comments. Wrong behaviour? It depends on what you can consider wrong. Consider running your own example and inputting <...
cr_oag's user avatar
  • 565
10 votes
Accepted

English Draughts

A couple of things: <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <StackPanel> ... Putting the ...
Johan Larsson's user avatar
10 votes

GUI for a quiz tool or game

1. Instead of: def __init__(self, root): """Constructor""" self.root = root # root is a passed Tk object do: ...
Samwise's user avatar
  • 3,990
8 votes

Implementing a customized helpful hints function which includes docstring but much shorter than Python help()

Disclaimer Now that the OP has clarified that they intend to use this as a teaching tool, my answer has lost relevance for their use-case. It can still be taken as general advice for most Python ...
Graham's user avatar
  • 1,369
7 votes

Digital root computation with benchmarking

I think your algorithmic part is exceedingly verbose. One of the nicenesses of Python is how it can lead to code that reads almost like English. And for this particular problem, even leaving ...
Jaime's user avatar
  • 6,562
7 votes
Accepted

Implementing a customized helpful hints function which includes docstring but much shorter than Python help()

I'm not sure whether you're reinventing the wheel, but you are using the wrong tools for the job. I've been through the phase where I think I'm doing something unique enough that I need to do ...
jpmc26's user avatar
  • 1,203
5 votes
Accepted

Populating Day/Month Selections in UserForm Controls

Why not doing it more directly like this: ...
Dirk Reichel's user avatar
5 votes

Digital root computation with benchmarking

Regarding digits_generator You don't need to use a new variable. You could use nb directly. You may use the fact that non-0 ...
SylvainD's user avatar
  • 29.2k
5 votes
Accepted

Swing GUI in Java

Yes, that is proper use of composition over inheritance. Although some may say this is actually aggregation, due to the nature of Swing. Composotion is the act of one object owning another object. ...
Dioxin's user avatar
  • 424
5 votes
Accepted

JavaScript discrete slider web component

It looks like you've put a lot of work into this and it appears to function well. There are only a few suggestions - see below. I agree with the comment by user3342816 that the flipped sliders seem ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
4 votes

English Draughts

I've spotted... private string PlayerToString(Types.Player player) => player.IsWhite ? nameof(Types.Player.White) : nameof(Types.Player.Black); I find the ...
t3chb0t's user avatar
  • 44.2k
4 votes

Single page site with navigation bar

You should add <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> to your <...
Denis Priebe's user avatar
4 votes

Textbased User Interface for user and program taking turns

The very first thing that jumps out at me is the indirection of maintaining both a list of possible words and a seen list. Picking a better representation for your state will make bookkeeping easier. ...
R B's user avatar
  • 1,023
4 votes
Accepted

Table View Controller class in Swift

There are quite a few issues here: In switch statement, you don’t need/want break statements. Unlike C languages, Swift ...
Rob's user avatar
  • 2,427
4 votes

GUI for a quiz tool or game

If talking about code readability, I'd recommend you to read PEP-8 at first, for example: def one(): pass def two(): pass This is how you don't want your ...
finally's user avatar
  • 141
3 votes
Accepted

TextBoxes for various number types

class TextBoxNum Abbreviation should be avoided when naming a class: Num -> Numeric The ...
Xiaoy312's user avatar
  • 3,136
3 votes
Accepted

Textbased User Interface for user and program taking turns

The main issue with this code is that basically everything “lives” in IO. One of the advantages of Haskell over other programming languages is the ability to ...
Alexis King's user avatar
  • 3,172
3 votes

Managing drag in React on-off component

Maybe it would be better to handle onMouseUp={this.onDragEnd}? Also instead of const componentDefaults you can use ...
user2808747's user avatar
3 votes
Accepted

UserForm to handle Date Inputs (Day,Month,Year)

This is going to make for either a poor UI or a change in behavior later. Better to just change its behavior now. ...
RubberDuck's user avatar
  • 30.8k
3 votes
Accepted

Giveth me thy easier user input in C++ - follow up

Redefinition of default arguments First of all, you cannot redefine default arguments. From [dcl.fct.default], slightly abridging the example: A default argument shall not be redefined by a later ...
Barry's user avatar
  • 18.4k
3 votes

Swing GUI in Java

...
Justin's user avatar
  • 3,285
3 votes
Accepted

Digital root computation with benchmarking

Here are a few things: Instead of if ans[0] == 'n': again = False print 'Bye !' break elif ans[0] == 'y': again = True break ... return again ...
Graipher's user avatar
  • 40.9k
3 votes

Easier user input in C++

Is there a need for include guards? Yes, but #pragma once is redundant and also not portable. Is it okay to patch easy_input into std without problems? Is this ...
user86418's user avatar
3 votes
Accepted

Disable execution of parts of the code based on user's choice C++

I see two things: option acquisition (a lot of control flow and ad-hoc checks to detect the user input) operational program flow (the decisions based on it). Here I'd suggest Null Object pattern ...
sehe's user avatar
  • 1,322
3 votes

Poké-permalinks

I'd appreciate any feedback on improving perceived responsiveness for the feature this UserScript adds to the webpage. Since you are trying to synchronize the display of the image and the current URL ...
Grant Miller's user avatar
3 votes
Accepted

Simple view for CRUD with miglayout

Quickfire opinions: Swing is deprecated. If you have the choice: do not use swing! Empty lines are a useful thing. It's pretty conventional to use empty lines between members and around the import ...
Vogel612's user avatar
  • 25.2k
3 votes
Accepted

Python coin flipper with GUI

You are abusing the heads & tails lists into making simple counters. ...
AJNeufeld's user avatar
  • 33.3k
3 votes

Implementing a customized helpful hints function which includes docstring but much shorter than Python help()

It is difficult to add anything to the existing great and detailed answers, but, to follow up your comment that .__doc__ might be to difficult to remember for ...
alecxe's user avatar
  • 17.2k

Only top scored, non community-wiki answers of a minimum length are eligible