Hot answers tagged

19 votes

Recreating Minesweeper

Overall Impression This code is not maintainable in its current state. Good code should always be maintainable. Code Readability The code is very difficult to read. This line of code in ...
pacmaninbw's user avatar
  • 23.8k
17 votes
Accepted

Python command-line program that generates passwords

Put all code in functions. Code in functions can be tested, experimented with, and reorganized much more easily than code floating around at the top level. Floating code introduces the temptation to ...
FMc's user avatar
  • 12.7k
16 votes
Accepted

Conway's Game of Life Terminal Visualization in C

I'm impressed that this is your first project in C -- it's good! What follows are some comments on what's good that you should continue to do and then some suggestions for improvements. What's good? ...
Edward's user avatar
  • 66.4k
14 votes

Python command-line program that generates passwords

I feel like you came up with an over-engineered solution that, ultimately, fails to meet expectations. Generating a password is a task with well-defined use-cases, that we encounter almost daily. Most ...
gazoh's user avatar
  • 3,179
12 votes
Accepted

Currency Converter (calling an api in c#)

Don't use double for currency The double type can't accurately represent base-10 decimal numbers. This is fine for a lot of ...
gazoh's user avatar
  • 3,179
10 votes
Accepted

Python code using *args to print warnings in color

The globals aren't doing much for you, so get rid of them. Your code will not do the right thing if an argument fails to print: the colour will not be reset. Add a ...
Reinderien's user avatar
  • 60.8k
10 votes

Conway's Game of Life Terminal Visualization in C

I can't (yet?) comment on the (excellent) first answer, or I would. But I have a few comments to add to what has already been said: In Unix you don't need to check the result of malloc, if having the ...
jimc's user avatar
  • 101
9 votes

Recreating Minesweeper

Don't use system("cls") Clearing the screen this way is very inefficient: it creates a new process running cmd.exe, which in turn has to interpret the ...
G. Sliepen's user avatar
  • 54.2k
8 votes

Currency Converter (calling an api in c#)

I notice that you're using terms like "dollar" and "euro" to denote currency. This is fine, but there are questions like which dollar. Looking at the code, it uses USD, but dollar ...
Hayden's user avatar
  • 369
8 votes

C# console app that draws an image to the console using ASCII

Disclaimer: I could not either run it locally (because I'm working on a Mac) or via dotnet fiddle (which works on some Linux distro) because Gdip threw a ...
Peter Csala's user avatar
  • 8,820
7 votes

Write SQL Server table to Parquet file

Quick remarks: Your code doesn't follow the coding conventions (camel-case, pascal-case, etc.). string SourceObject_IsTable = args[2]; has a bad name and isn't ...
BCdotWEB's user avatar
  • 11.2k
7 votes

CAT: Cat Approved TUIs

You appear to be asking for a review the part of the code you posted, not the library itself. (ETA: I wrote this before you posted any of the library code.) I’m not sure how useful that will be, but ...
Davislor's user avatar
  • 6,821
7 votes

C# console app that draws an image to the console using ASCII

I'm semi-new to programming and want to improve my skills by understanding how people might optimize their code and how the code should be structured Excellent. First bit of advice: Always start with ...
Eric Lippert's user avatar
  • 14.9k
6 votes

Python code using *args to print warnings in color

am I horribly misusing *arg? I've never used it before, and so often stuff that just works can backfire in unexpected ways once I try to get it to do more. I wouldn't say you are misusing it (though ...
chepner's user avatar
  • 333
6 votes
Accepted

ds - A directory switcher via tags in Windows command line

Reconsider Your Imports Currently, you’re importing pretty much every identifier from std:: that you use. I actively avoid this for names like ...
Davislor's user avatar
  • 6,821
6 votes
Accepted

Skeleton for a command-line program that takes files in C

Use getopt_long() to parse the command line Parsing a command line quickly becomes more complex if you want to allow a combination of regular arguments (like ...
G. Sliepen's user avatar
  • 54.2k
6 votes

Skeleton for a command-line program that takes files in C

Not much to add after @G. Sliepen. Avoid manual formatting Save time. Avoid manual formatting and use the auto formatting available via various tool chains. Why check program name? In ...
chux - Reinstate Monica's user avatar
6 votes

CAT: Cat Approved TUIs

Unfortunately you've only shown some of the header files, but no concrete implementation of your TUI library, so I cannot meaningfully review that. However, we can look at your intended use of the TUI....
G. Sliepen's user avatar
  • 54.2k
5 votes

iChemistry - Learn chemistry with python

compund.py It looks like your Compund is not doing any business logic, so it would make sense to define it as a dataclass (or a pydantic model, which has benefits ...
Gameplay's user avatar
  • 161
5 votes

Python command-line program that generates passwords

Another perspective: adopting legacy* code I agree with the other answers and I would never use this code to generate passwords, since (1) it's not cryptographically secure and (2) it's highly opaque, ...
2e0byo's user avatar
  • 321
5 votes
Accepted

unit converter (3 days of C#)

First of all congratulation, you are on a good way to become a software developer. The solution itself is far from perfect but it is a good start. In this post I would like to focus on two things: ...
Peter Csala's user avatar
  • 8,820
5 votes

A simple CLI arbitrary-precision Mandelbrot set calculator (for a single point)

General Observations The good, the call to malloc() is tested for success, the code is properly indented and there are symbolic constants rather than raw numbers in ...
pacmaninbw's user avatar
  • 23.8k
5 votes
Accepted

A simple CLI arbitrary-precision Mandelbrot set calculator (for a single point)

Only for the pedantic strtou...() functions have a quirk in that strtoumax("-1", &endptr, 10) is some large ...
chux - Reinstate Monica's user avatar
5 votes
Accepted

Calling the base method from overriden method to add some functionality

When you Generate an override in Visual Studio, a call to the base method is automatically added. This is quite a common way to extend the behavior of a method. If you do not call the base method, you ...
Olivier Jacot-Descombes's user avatar
5 votes
Accepted

A Python terminal

.pylect.password.py Your file naming is non-standard. I have some concerns with prefixing python files with ., and using ...
Peilonrayz's user avatar
  • 43k
5 votes
Accepted

Little CLI game in C++ with random words

General Observations An interesting new twist on an old game! Using Wikipedia as a source gives a lot of possible words. There is a lot of good ideas here, but there can be some improvement. An ...
pacmaninbw's user avatar
  • 23.8k
5 votes

Reassure user that python code is running during long imports

A strange game. The only winning move is not to play. -- War Games, Joshua / WOPR I don't know what your set of imports is. ... the user sits in front of an ...
J_H's user avatar
  • 22.3k
4 votes

unit converter (3 days of C#)

Congratulations on creating your first program from scratch. Since you're new to programming, I'll try and give you a few tips on how to make your program a little more maintainable. Repetition In a ...
Hayden's user avatar
  • 369
4 votes

unit converter (3 days of C#)

Adding to the other answers, and adding some more complex ideas, I'd suggest that you use a type to contain configuration data for the various measurement units you can convert between. Take this for ...
Corey's user avatar
  • 805
4 votes

Python code using *args to print warnings in color

Here is my go at it. First your code doesn't work if the function receives a sequence instead of unpacked strs: ...
Ξένη Γήινος's user avatar

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