Questions tagged [code-quality]
Questions for best practices for writing high quality code.
                656 questions
            
            
            
                4
            
            votes
        
        
            
                1
            
            answer
        
        
            
                990
            
            views
        
        
            
            
            
        CA-1822: Mark members as static Roslyn recommendation will not unnecessarily increase memory consumption?
                    My job uses SonarQube as part of the CI/CD quality gate. One of the "Maintainability" issues (severity: medium) raised is the CA-1822: Mark members as static.
The link explains the added ...
                
            
       
        
            
                4
            
            votes
        
        
            
                1
            
            answer
        
        
            
                427
            
            views
        
        
            
            
            
        Best way to "verify" programs
                    As we know, determining the semantic properties of programs is an undecidable problem (e.g. Halting, commonly attributed to Turing). But tools such as static analysis (notably that of Clang/LLVM) are ...
                
            
       
        
            
                5
            
            votes
        
        
            
                1
            
            answer
        
        
            
                575
            
            views
        
        
            
            
            
        Confused on how abstraction and encapsulation is helpful
                    Using assimp I've created a function to load 3D models and it does everything I need and I don't plan to use another library or write something custom, however, I am curious how techniques such as ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                225
            
            views
        
        
            
            
            
        Our php codes base has 6 different ways to do INSERT … ON DUPLICATE KEY UPDATE, how do I fix it?
                    Our php codes base has 6 different ways to do INSERT … ON DUPLICATE KEY UPDATE. It happened over years because the php framework is evolving and my team members come and go, although I won't say we ...
                
            
       
        
            
                2
            
            votes
        
        
            
                3
            
            answers
        
        
            
                341
            
            views
        
        
            
            
        Displaying a list of similar but different objects without resorting to type checking
                    I'm creating the UI for a "Point of Sale" type page. You can add orders, grouped orders, and custom items to your transaction, and it should display these in a list so you can see what you ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                275
            
            views
        
        
            
            
        How to deal with very complex codebase? [duplicate]
                    I recently changed my job to a big MNC and the code I am exposed to is highly complicated, difficult to read and understand. Although it is divided in microservices and runs on local I have to keep ...
                
            
       
        
            
                17
            
            votes
        
        
            
                8
            
            answers
        
        
            
                7k
            
            views
        
        
            
            
            
        How to be (more) critical during Code Reviews? [closed]
                    I'm a Software Engineer who sometimes need to review the code of my fellow team members. I often look at the source code and think; this looks fine. I'm having a hard time to think critical about it. ...
                
            
       
        
            
                21
            
            votes
        
        
            
                4
            
            answers
        
        
            
                10k
            
            views
        
        
            
            
            
        In C, if I am passing a file descriptor to a function, should I close it in the function or in the place where I called the function?
                    I have a situation like the following:
int fds[2];
pipe(fds);
// Write lots of stuff into fds[1]
close(fds[1]);
do_stuff(fds[0]);
// Should I close fds[0] here or at the end of do_stuff?
Which one ...
                
            
       
        
            
                19
            
            votes
        
        
            
                9
            
            answers
        
        
            
                7k
            
            views
        
        
            
            
            
        Why should we reuse code as binary modules instead of copy/pasting?
                    So this is a basic question that was asked by a junior developer (not in these exact words). He had worked on a feature which was used in multiple projects. The main feature can be easily isolated and ...
                
            
       
        
            
                18
            
            votes
        
        
            
                6
            
            answers
        
        
            
                5k
            
            views
        
        
            
            
        Is setRGBColor(32,128,192) a valid use of magic number?
                    According to When is a number a magic number?, I know magic number should not exists, so I know the following code  about creating a Label from some UI framework and set the color RGB needs to be ...
                
            
       
        
            
                40
            
            votes
        
        
            
                11
            
            answers
        
        
            
                14k
            
            views
        
        
            
            
            
        Should developers fix bugs in their own code? [closed]
                    This is more of a philosophical question.
I have recently started working on a new team and I see here a pressure on developers to fix bugs in their own code. Whenever a bug is found in a feature, the ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                302
            
            views
        
        
            
            
            
        Is module scoped initialisation considered a bad practice?
                    A module app.js includes another module service.js. The service.js module/file contains some functions but also does some module scoped initialisations(registry variable).
// service.js
const ...
                
            
       
        
            
                0
            
            votes
        
        
            
                2
            
            answers
        
        
            
                179
            
            views
        
        
            
            
            
        Is usage of "with" prefix acceptable for filter methods that are specific(not generic) [closed]
                    I am not a native english speaker so I have the following question related to naming I have a class that has generic filter method of type:
filter(Predicate predicate)
In the same class I have some ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                292
            
            views
        
        
            
            
            
        Working with a poorly written piece of software as an entry-level developer with no support or documentation [duplicate]
                    I'm and entry-level developer straight out of college. I am the only developer at this company.
I feel the challenges I face are different to most people working with sub optimal or very poorly ...
                
            
       
        
            
                2
            
            votes
        
        
            
                5
            
            answers
        
        
            
                576
            
            views
        
        
            
            
            
        Is it a code smell for a factory to have many methods?
                    I have a testing project, in Katalon Studio, that uses data classes, called models. This is a conscious design decision.
Also a conscious design decision, is the decision to separate the concern of ...