Skip to main content

All Questions

-1 votes
1 answer
157 views

I have the below Python code which checks whether the ssh host is up or not: `for hostname ,ipaddr in host_dict.items(): if tcp_conn.tcp_port_is_open(ipaddr, constants.TCP_PORT, ...
Saurav K's user avatar
1 vote
0 answers
99 views

I have lots of method and on each method I have to do a validation. Currently, my code look like this and it works fine. @Service public class UserService { @Autowired private UserValidation ...
Justin Xu's user avatar
1 vote
1 answer
127 views

I am learning Clean Code and Refactoring. And my project has many long method with view access, something like this. private fun updateStatusFragmentUI(statusData: StatusListData.StatusData) = ...
c-an's user avatar
  • 4,218
2 votes
2 answers
1k views

For example, I have an HTTP request that handles some entity creation (let it be Role) And validation looks like this: class CreateRole extends FormRequest { public function rules() { ...
MAXIMAN's user avatar
  • 165
0 votes
2 answers
259 views

So, I want to write these kind of things for my code, but there's too much code for one variable. How can I use modern Java for solving this problem shorter or cleaner? Moving it in the separate ...
KhoDis's user avatar
  • 149
1 vote
2 answers
165 views

I recently noticed a function written earlier in our code base which I'm certain is logically incorrect. Function is written in TypeScript and its body goes like this: const getUserInitials = (user: ...
john doe's user avatar
-1 votes
1 answer
97 views

The task is to calculate money cost based on passed distance. Here is tariff plan: 1-100 kilometres evaluates to 105 USD 100-300 km evaluates to 55 USD 300-any evaluates to 30 USD If passed distance ...
sskoryi's user avatar
  • 11
2 votes
1 answer
111 views

I have the following code: for (const element of elements) { try { // eslint-disable-next-line no-await-in-loop const { a, b, c, d, e } = await func(element.id); if (tokens.includes(a)) ...
Raul's user avatar
  • 3,153
0 votes
1 answer
519 views

I have a function, which is associated with a specific concept "Notifications". After creating a module "Notifications.js", I have written the following: function Notifications() {}...
Raul's user avatar
  • 3,153
0 votes
0 answers
191 views

In visual studio 2015 we have a solution with c# and javascript files. For the javascript files, we use a .eslintrc.json file for code conventions. However, everytime I build the solution, these files ...
Jordi Verheul's user avatar
0 votes
2 answers
305 views

I am creating a tab navigator which listen to my database and renders 5 different icons, one of them with a badge. Currenlty, I am making this with a switch-case, to avoid returning the same component ...
Conchi Bermejo's user avatar
0 votes
2 answers
203 views

For example, a have two statement conditions: First, something similar to const condition1 = value === '' && value1 === '' && value2 === '' && valu3e === '' && value4 ==...
nikan's user avatar
  • 21
4 votes
1 answer
12k views

I have three validators each sequentially dependent on the previous. I might use all three or only the first two or only the first one. E.g. Validator 1: Checks whether user exists Validator 2: ...
user avatar
-1 votes
1 answer
77 views

I have a class "Firebase" in which I write all the functions (that involve this service) used in my server side. At first, the code was pretty clean and clear, as there were not a lot of ...
Victor Molina's user avatar
-1 votes
3 answers
328 views

I have a function that prepares a receipt output. But since it has all kinds of conditions it ends up being very long and difficult to understand.. How would one go about refactoring this? Any ideas? ...
Martin Zeltin's user avatar

15 30 50 per page
1
2 3 4 5
9