Skip to main content

Questions tagged [refactoring]

Refactoring is a disciplined technique for restructuring existing code, altering its internal structure without changing its external behavior. Open-ended questions about refactoring your code are off-topic for Stack Overflow, however they may be appropriate for Code Review.

0 votes
0 answers
7 views

Moving logging functionalities further out of test code

Context To verify the relevant test cases are reached during fuzz testing with foundry, I wrote a system that creates a new log file at the start of a fuzz test, and then uses that to log the which ...
a.t.'s user avatar
  • 2,584
0 votes
0 answers
11 views

Consume Jotai atoms in component or in wrapper container and pass them down as props?

I have a question about how to refactor overlay components in a very big WebApp with Jotai. I have two options in mind and would like your opinion on them. The goal is to prevent rerendering of ...
sakramento's user avatar
-1 votes
1 answer
44 views

Correct approach to refactor duplicate API Call to different endpoints

I have two methods that make a call to two different endpoints. The logic is exactly the same, however the API Endpoints have to be kept seperate. How would you refactor this? public List<...
Josip Domazet's user avatar
1 vote
1 answer
71 views

Pythonic refactor advice needed

I am writing a tokenizer for files that have ignored preamble. The files are written in Markdown and there is a list of keywords in H1 titles that change the state of the parser. When an EOF is ...
pawkw's user avatar
  • 59
0 votes
1 answer
49 views

How to plan migration from EF 6 with EDMX to EF Core

We have a pretty complex .EDMX in EF 6.0 which was designed using database-first approach (against SQL Server) back in 2014. It uses lot of features of EF like TPT, TPC, TPH, entity splitting, custom ...
Shantanu Gupta's user avatar
0 votes
0 answers
39 views

Creating separate table for each child entity in EF Core

I've recently stumbled into an issue in EF Core when I needed the parent entities to reference the child entities in one to many relationship. Since all parents are using the same child class and the ...
Alex's user avatar
  • 5,068
0 votes
1 answer
72 views

How to Remove Wildcard Imports from a Large Python Repository?

I am working on a large python project that contains many thousands of files, includes a mix of independent scripts (many with main functions) and common modules. Unfortunately, in my project there is ...
Kfir Ettinger's user avatar
0 votes
2 answers
47 views

IntelliJ refactoring: join two variables into once

I have this class @Data @NoArgsConstructor public class DittaIndividualeDTO implements Dati { private String denominazione; private String nome; private String cognome; private String ...
Lore's user avatar
  • 1,682
0 votes
0 answers
18 views

EF Core: Refactor IEntityTypeConfigurations?

In EF Core we can use IEntityTypeConfiguration for a more SOLID approach for configuring our model. Is there any VS Extension or something similar existing for replacing that annoying copy&paste ...
Ontario's user avatar
  • 23
-1 votes
1 answer
27 views

I want to add retry logic and. refactor the code in the python socket connect code

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
0 votes
2 answers
56 views

How to automate a series of similar IF statements

I have a series of IF statements that I think should be automated into a shorter piece of code but I'm not sure how to go about doing it. Here's an example of the code: var supplier_kw_per_rack = 2; ...
Chuwa Feet's user avatar
0 votes
0 answers
34 views

Is anti-pattern to handle redirections and view variables within Cake Components?

I am working on a project with CakePHP 2.x and I found 3 Controllers that share the same logic but some part of that logic is to set view variables and redirections. class ControllerA { public ...
pacoCham's user avatar
0 votes
0 answers
37 views

Refactor multiple public classes in a folder/namespace to internal classes

Imagine 10 public classes in a folder/namespace. I want to make all of them internal. Any way to do this using Rider without modifying each file manually?
me.at.coding's user avatar
  • 16.6k
3 votes
3 answers
73 views

How to refactor similar functions in Python?

I have defined multiple functions where I search for a specific pydantic model in a list of pydantic models based on some attribute value. SocketIOUserSessionID = str RoomWithIndex = tuple[Room, ...
Slava Pasedko's user avatar
0 votes
0 answers
65 views

Refactor the method

I have a method that works with both a list and a single element. Is there a concise way to accept either of these types (perhaps using generics, etc) public void write(MyInter elemen){ ...
Hamvy B's user avatar

15 30 50 per page
1
2 3 4 5
533