Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Programming Practices are the commonly or not so commonly used practices in development of software. These can include things like Agile Development, Kanban, Coding shortcuts, etc.

1
vote
1answer
27 views

Balancer that delegates requests to servers and problem with Websockets

Lets have an application that has real-time chat feature. The chat requires websockets in order to function real-time. Now imagine we have "balancer" and 3 application servers. Instance of ...
0
votes
1answer
25 views

Is it good practice to use data API for access cross platform

All, Question: Should I have a common data access API between various cross platform applications or keep the data access specific to the UI even though it would result in duplication? Background: ...
0
votes
1answer
126 views

If statement best practice [duplicate]

I am reviewing best practice with if statements. Below in example A I include the entire code to be run and ensure it remains within the if statement. While for example B the code to be executed ...
-1
votes
2answers
155 views

Dealing with software quirks

I was just reviewing some code and realised it is going to introduce the possibility for a situation where the numbers our staff use on a daily basis could be slightly out of line with the numbers we ...
-3
votes
1answer
121 views

Should I directly use pre-built codes on Github? [closed]

I need to know if is it correct to use pre-built codes on Github, or try to build it my self, while even I tried to build it I think it won't be as proffissional as that one on Github... the point is ...
1
vote
1answer
27 views

UI in code behind vs UI in specific view language/markup

I have heard some developers say they prefer to build their UIs in code behind... I am of the opinion that this leads them to write really bad code... Super large functions, spaghetti code, and mixed ...
1
vote
4answers
224 views

What should be the last entry in a switch/case statement?

When writing a switch statement that only ever has to deal with a known set of values (imagine an implicit enumeration), I find myself wondering what should be the last entry in the construct. I'm ...
2
votes
2answers
139 views

The dilemma of implementing virtual inheritance

I am working on a program language, and I came to the dilemma whether it should support virtual inheritance or not. As a designer and implementer of the language, including that feature represents ...
2
votes
2answers
153 views

Persuading management that good software engineering is worth the effort [duplicate]

Background: I work for a small company which does not have a set of established best practices for designing software. I was hired to work on a project which gathers data from a stream, does some ...
2
votes
1answer
80 views

How to optimize a complex task with multiple DB calls

I have been working on a multi-layer, sale management application developed with WPF and partly refactored with EF6 (long story). The application has some very complex tasks which require multiple ...
0
votes
2answers
130 views

Building dynamic code that can still handle many one-offs?

So we're having a rather heated debate at work as to what would be the best practice going forward while refactoring our reporting system. Most of us have some strong opinions one way or the other, ...
1
vote
3answers
258 views

Bug-preventing vs clean code

If I'm faced with the decision to write clean, beautiful code, but I'd be opening up a new path bugs could take to appear, should I take it? (Provided I'm not willing to spend the time to come up with ...
0
votes
1answer
97 views

Large executable size due to libraries/frameworks

My question sounds a bit dumb. Usually we are suggested to use existing libraries or frameworks, to avoid reinventing the wheel, or to achieve some "good practices" (e.g. during software distribution)...
1
vote
2answers
97 views

My implementation accepts only URLClassLoader, may I be less restrictive in my method signature?

I wrote a Java API that accepts ClassLoaders as parameter, even though it won't accept any ClassLoader that isn't a URLClassLoader (because I'm only interested in the URLClassLoader::getURLs() method):...
-1
votes
1answer
139 views

Passing an inputStream vs String [closed]

I have a file on the disk. I want a clear distinction of responsibilities between my reader and parser. The reader reads the file and extracts the content as a string. This string is input to the ...
-6
votes
3answers
159 views

Why do languages distinguish between arguments and parameters?

Also, if my argument and parameter are the same value can I just use the same identifier for both? Thanks
0
votes
1answer
64 views

Best design pattern for Notification System => How to handle multiple languages and items

As always I came here to ask for some light in a design issue I am facing. I have a system that issues some notifications : PackageReceivedNotification PackageSentNotification ...
1
vote
1answer
154 views

Limitations of using classes as interface

I am an Electrical Engineer now training and working as an embedded software developer, so I have little formal computer science and software design training. I have until a few months ago only worked ...
0
votes
0answers
49 views

Best practice to populate a `container` class

lets say I have several objects Object A,Object B,Object C in different parts of my project. I have defined a Object X that is only used to store some specific values from the objects mentioned above ...
0
votes
1answer
108 views

Advantage or disadvantage of using = operator or uniform initializer while using auto keyword

Most examples of auto use the = operator. #include <iostream> int main() { auto a = 1; std::cout << a << '\n'; } Why don't they use the uniform initializer like this? #...
-1
votes
1answer
108 views

Generic method with different arguments

In the following scenario: A factory returns an object of a logic class: ILogicClass object = factory.GetByRequirements(reqs); I then want to invoke a method and get some results which are in the ...
0
votes
1answer
90 views

Why “typeof null == object” will stay in javascript?

I was reading a article about front-end development on Medium, when I stumbled upon an interesting piece of information, which is as follows: The type of a variable can be determined by using the ...
12
votes
5answers
628 views

In what conditions (if any) is it good practice to query two servers and only consume the fastest response?

I've asked what is now a deleted-by-Community question on SO on why would someone use javascript's Promise.race, and a high rep user commented this: If you have two services that compute some value ...
-1
votes
2answers
251 views

Does reading over code I've written make sense to verify it?

After writing some code, I have a habit of scanning it all over once or twice in order to look for any bugs. This is sometimes a painstaking and tedious process, and it takes up time. After reviewing ...
9
votes
4answers
557 views

Hiding/disabling features for some users

Lets say I have a free and paid version of the app. Paid version is a superset of the free version regarding features available to users, meaning paid version will have all the features of the free ...
-2
votes
1answer
61 views

Trying to find a quote — when you find a bug, fix all occurrences of it

I vaguely remember a quote from, IIRC Kernighan. Something along the lines of: when you find a bug, fix all occurrences of it I think it was either in the "Practice of Programming" or "The C ...
2
votes
1answer
53 views

How to select every x% of records for processing

I'm processing a stream of incoming records, for clarity assume they're numbered consecutively 1,2,3....etc. Most of the time the records are arriving slowly enough for me to process every single ...
7
votes
7answers
1k views

Best practice to “continue” from inside a nested loop?

Here is a simplified sample. Basically, it does checks on a string from a string list. If the check passes, it will remove that string (filterStringOut(i);), and it is no longer ...
0
votes
0answers
46 views

Best practices to check permissions in a webapp based on api?

Let's say I build an api server and a angular/react/whatever client webapp. I can authenticate and store auth token, no issue with that. Is there andy best practice on how to handle users ...
8
votes
6answers
3k views

what can go wrong in context of functional programming if my object is mutable?

I can see the benefits of mutable vs immutable objects like immutable objects take away lot of hard to troubleshoot issues in multi threaded programming due to shared and writeable state. On the ...
110
votes
12answers
21k views

Why are multiple programming languages used in the development of one product or piece of software?

I am a recent grad student aiming to start my Master's in Computer Science. I have come across multiple open source projects that really intrigue me and encourage me to contribute to them (CloudStack, ...
4
votes
2answers
332 views

Should I duplicate code across languages?

Where I work, we use a language for our desktop software development (Delphi) and an other for web apps (asp.net/c#). My bosses want me to implement a feature on a website but they ask me to develop ...
1
vote
1answer
81 views

Scheduling Rules and Complexity in Coding Lots of rules respect to time?

We have some fields (age, visit type, insurance type, city) and some rules: Some doctors that define weekly schedule template like as: Doctor D1 works on Monday 7-9 pm , Thursday 7-9 pm. Some type ...
-2
votes
2answers
211 views

Should you make objects are generic as possible when planning out architecture?

I'm trying to improve my skills in planning out clean, modular projects with minimal coupling. Is it best to keep objects as generic as possible? If so, are there any pitfalls I should try and avoid ...
0
votes
2answers
160 views

What is the safest practice in handling QWidget pointer lifespan in a QObject oriented environment?

Consider the following constructor: NetworkTools::NetworkTools(QObject *parent) : QObject(parent) { view = new QWebEngineView(); view->setParent(parent); // Produces an error, shown below. ...
1
vote
0answers
211 views

What are a few arguments against SOLID principles? [closed]

I've been practicing SOLID in my code-base (PHP) as best as I could as of late and the progress is clear. Code is more readable, more maintainable and everything in-between. The problem is that I ...
4
votes
3answers
253 views

Agile methodology in pure technical terms

I often hear about agility processes, but it seems to me that it is (nearly) always tied to team organization and delivery processes. It (nearly, once again) never comes to the bottom of the bottle: ...
3
votes
1answer
136 views

What is the standard method of handling errors in a NodeJS web app?

I am currently working on a web application as a learning project, which has a NodeJS backend and uses a MongoDB database; however, I believe my question is not specific to the technologies I am using....
1
vote
2answers
64 views

Mapping entities to VMs and back - should we use operator overloading or constructor + a convert method?

I got the following entity and VM: public class Student { public int ID {get;set;} public string FirstName {get;set;} ... } public class StudentVM { public int ID {get;set;} ...
2
votes
1answer
220 views

How to reconcile 'notebook'-style programming with other best practices?

I try to write most of my code using standard practices. Those include amongst other and related to this specific question having short-ish functions, well encapsulated objects when OO is used, not ...
4
votes
2answers
242 views

Querying from database inside a loop a bad practice? [duplicate]

First, I'm still learning to do things in the best possible practices. I would like to know what would be a best practice when dealing with database queries. I've seen codes that query inside the loop ...
0
votes
3answers
127 views

Root Cause Analysis in Microservices Environment

This question is a result of an internal debate involving R&D, DevOps and Automation departments of the company I work for. Here's the nutshell of the debate: automation: We need SSH access to ...
2
votes
3answers
474 views

Does it make sense to use string constants in Python instead of string literals as keys?

There is a dictionary in my class with informative, short string constants as keys that identify certain parts of the solution, like "velocity", "death_star_power_output". My colleague suggested that ...
4
votes
4answers
193 views

How to deal with Law of Demeter in the product - owner relationship?

I want to display the product, and the product card has a lot of information about the product and the owner. How to deal with Law of Demeter in this product - owner relationship? In controller I ...
-2
votes
2answers
605 views

Algorithm for scheduling shifts

I am trying to write a program to help scheduling shifts for the employees of a small business. There are 28 shifts that needs to be assigned to 28 employees (so this means that each person gets a ...
1
vote
2answers
338 views

Best Practices - Including endpoint URL calls in JavaScript vs backend calls

I am building a web application that will retrieve results from a remote server and use them to render some charts and maps. The remote server has already been implemented and contains a large amount ...
5
votes
5answers
808 views

What is more important? SOLID or KISS?

What is more important? SOLID or KISS? To be consistent with SOLID I would have to inject Decorator and Footer classes and create interfaces for them. public class HelloService { String name; ...
4
votes
5answers
909 views

What to do with long variable names?

First example: countryRepository.getCountriesFromAsiaWhereAreTheMostPlanesAndBoats(); countryRepository.getCountriesFromAfricaWhereAreTheMostCars(); Are these names too big? How else do we call ...
6
votes
1answer
584 views

Exceptions in DDD

I'm learning DDD and I'm thinking about throwing exceptions in certain situations. I understand that an object can not enter to a bad state so here the exceptions are fine, but in many examples ...
2
votes
5answers
388 views

What should a constructor contain?

What should a constructor contain? In both cases, all three arguments are needed for the class to work. Which approach is better and why? 1) class Language { LanguageRepository ...