Skip to main content
Filter by
Sorted by
Tagged with
Advice
4 votes
14 replies
237 views

I currently have a block of code looking like this: if (StateA) { DoSomething(); } else if (StateB) { DoSomething(); DoSomethingElse(); } I was thinking there must be an elegant way ...
lenny's user avatar
  • 793
0 votes
0 answers
21 views

Good day, I'm trying to improve my OOP competence and trying to create a code to generate a single window(gui) which hold n checkboxes based on the files the code finds in a specific folder. The idea ...
John Smith's user avatar
0 votes
2 answers
116 views

I'm currently trying to build a string parser for an AVR based stepper motor controller. The idea is to observe some input string over UART, then breaking apart this string into several sub-buffers ...
slurpeecup's user avatar
1 vote
5 answers
155 views

I have the Enum A, B, C. In a method, I am given two different Enum and must return the remaining Enum. Example: I receive A and C I must return B The solution that I have is to use if elseif else: ...
ATalkingMonkey's user avatar
-1 votes
1 answer
244 views

I was wondering if it is better to use directly "content = {}" parameter instead of "{}" despite I see more often people using "{}". Is the code cleaner or does the code ...
Mister Propre's user avatar
0 votes
2 answers
94 views

I'm learning the basic of Python dictionaries and am having an exercise on nesting dictionaries in a list. It basically told me to make 3 dictionaries about 3 people, nest them inside a list, loop ...
Hazel P's user avatar
  • 17
1 vote
2 answers
110 views

In C, I am calling many functions having to check if they worked. The code gets ~3x bigger because of it! An example: char *myStr = malloc(sizeof(char)); if (!myStr) return NULL; Is there a more ...
Gabriel Silva Schilive's user avatar
0 votes
2 answers
589 views

I am trying to import legacy_round from textstat as follows: from textstat.textstat import textstatistics,legacy_round But I get following error: ImportError: cannot import name 'legacy_round' from '...
Donya's user avatar
  • 65
1 vote
1 answer
318 views

Basically I always try my best to avoid comments whenever possible. I watched many videos from Uncle Bob and regarding the things he wants to express, there are many things I agree to. He once ...
Bratko's user avatar
  • 19
1 vote
0 answers
49 views

so I'm trying to implement a screen waypoint system, like you've probably seen in dozens of different games, where an icon is visible through walls, wherever the target is in the player's viewport. ...
Swanijam's user avatar
-3 votes
1 answer
62 views

I have this inteface: public interface ICommand { bool Execute(Vector2 commandPosition); bool Execute(GameUnit gameUnit); bool Execute(string shortcut); } And a class with these methods ...
ProtoTyPus's user avatar
  • 1,324
1 vote
2 answers
342 views

I'm somewhat of a beginner to java, although I understand the basics. I believed this was the best implementation for my problem, but obviously I may be wrong. This is a mock example I made, and I'm ...
labradorEater's user avatar
0 votes
0 answers
60 views

I have this code: class Base { public: Base(int attributeA, int attributeB, int attributeC) : attributeA_(attributeA), attributeB_(attributeB), attributeC_(...
Cedric Martens's user avatar
2 votes
0 answers
69 views

I am looking to calculate the Flesch-Kincaid grade level score of FOMC Statements. When trying to add a new variable for the Flesch-Kincaid score to the dataframe which includes FOMC Statements, I am ...
Varun Sinha's user avatar
1 vote
0 answers
222 views

We notice using mozilla/readability , we are unable to retrieve innerhtml for some of the websites. Is there anything, in particular, to be done to fetch these details ? const Readability = ...
Sunil's user avatar
  • 441
0 votes
1 answer
98 views

I was going through this Javascript tutorial when I came across a call for “one line – one action”. alert( 2 * counter++ ); Though technically okay, such notation usually makes code less readable. ...
hallofren's user avatar
  • 121
0 votes
1 answer
122 views

First of all I do not know if these types of questions are appropriate in stackoverflow. I have the following dict: file_dict = {"asda_20221003:ada":1, "scdfws_20221104eaf2we":5, &...
david.t_92's user avatar
  • 2,051
-1 votes
1 answer
286 views

I feel like the amount of while loops nested into each other isn't too readable and could be simplified down but I'm not sure how I can simplify it down. Could someone let me know what I would have to ...
omgeeitslexi's user avatar
0 votes
1 answer
2k views

Let's say we have an app, app.py, that does a variety of things. Of course, along the way, there is bound to be "helper" functions that do things such as cleaning data, creating a ...
bismo's user avatar
  • 1,645
2 votes
2 answers
117 views

I'm not a good programmer, for my bodypart-based collision detection in a game in unity I'm making I've ended up with a switch that looks like this despite my best attempts to simplify and shorten it: ...
ShrikeDev's user avatar
1 vote
0 answers
62 views

I have the following function in Swift and am looking to improve the readability: Adding the variables to the Array below all of the let variables seems kind of funky to me and I was thinking maybe it ...
Dylon Jaynes's user avatar
0 votes
0 answers
337 views

I'm trying to look at the readability scores for a text file using this Python code: posts = open("/Users/jchavis/Desktop/Data/posts.txt","r") readability_scores = Textatistic(...
JC91's user avatar
  • 11
2 votes
4 answers
2k views

I am going to try Flutter, but all examples on GitHub I've found includes code with a high nesting level of widgets that is bad for readability. For example, this one: https://github.com/smartherd/...
pepeevich's user avatar
  • 383
0 votes
0 answers
66 views

Say you have the following code: interface Foo { public int Value { get; set; } } class Bar : Foo { public int Value { get; set; } } Now suppose I'd like to give the Value property a more ...
Jens Steenmetz's user avatar
-1 votes
1 answer
159 views

Debugging old code in dynamically typed languages like Python, Ruby, JavaScript, etc. is often a struggle. For example, below Ruby function extracts only the key:val pairs from the result (hash) if a ...
Dante's user avatar
  • 537

1
2 3 4 5
15