All Questions
Tagged with design programming-practices
153 questions
0
votes
0
answers
69
views
Web application having database with OPC client
I'm designing a browser-based application that will display real-time data collected from OPC server. I have decided to use Angular framework for the browser application development. The browser ...
2
votes
4
answers
3k
views
I wrote a class with "init" method. Should I call it from other class methods? Or leave it to the object user? (Code Design)
I have a java class with an init method. It's different from the constructor. The constructor just initializes the variables/fields. The init method connects to a database and performs some ...
23
votes
6
answers
6k
views
How important is it to clearly understand requirements and architecture before starting to code? [closed]
Whenever possible I have been requiring an understanding of the requirements and architecture for the next scope of work before starting to code.
Sometimes due to schedule pressure on larger projects ...
-1
votes
7
answers
970
views
Proving program correctness under all possible cases
There are techniques of proving program correctness under all possible
cases, but that is a more advanced topic, for a later subject in your
curriculum.
I always had this doubt:
Is it possible to ...
0
votes
2
answers
2k
views
Store static data in public folder as json file or directly in .js file?
I'm busy working on a website – somewhat new to this – and I don't quite know where I should store static data: in the public folder as a separate json file, or within the .js file as an object.
In ...
2
votes
2
answers
592
views
Design of a modular application
I'm developing an application (Java) in a modular architecture. I have two approaches in mind and I'm not sure which one will be "better code" in case of maintenance and conventions.
I have ...
-1
votes
3
answers
717
views
Improving APIs that call 3rd party APIs [closed]
So I'm designing the backend of a platform that often calls other 3rd party APIs.
The issues I've noticed were latency issues (sometimes the calls were fast, others a bit slow >15s) and I'm ...
3
votes
4
answers
800
views
Is it a bad practice to have an interface method to tell whether it can handle an object?
interface Resolver {
boolean canResolve(SomeInput input);
SomeOutput resolve(SomeInput input);
}
public static void main(String[] args) {
List<Resolver> resolvers = ...;
...
-1
votes
1
answer
246
views
How to avoid cyclic dependency in UI application
I'm developing an UI application where I ran into an issue with a cyclic dependency. Here is the simplified code, to explain the problem.
#include <list>
class UiStyle;
UiStyle* CreateStyle();
...
1
vote
4
answers
180
views
How to design a program that would definitely use microservices in production, but which I want to demo on a virtual machine for my portfolio?
So I am an independent software developer and I'm building up my portfolio in the hopes of helping with job applications. I have a broad design for a web based "app" (not really like a phone ...
20
votes
8
answers
22k
views
Is an empty 'while' loop bad practice?
Consider the following:
public boolean maybeUpdateTime() {
if (this.timeReference.isAfter(lastInterval.getBeginning()) {
this.timeReference = lastInterval.getEnd();
lastInterval = ...
0
votes
3
answers
211
views
When using a DSL to structure my application, should I favor coupling the code with the DSL, or trying to have majority of my code independent of it?
We're currently using the Apache Camel Java DSL to structure our application, but I guess this question can mostly apply to any DSL in general.
Now, amongst our developers, we are divided on two polar ...
0
votes
1
answer
412
views
What is the most common stateless way for authentication in microservices?
I'm trying to get into Microservices by creating a project, so far I've stumbled upon authentication mechanisms, in a monolithic architecture, the client (web app) would send a request with the user ...
0
votes
4
answers
183
views
Prevent developer errors / debugging help
How much should I factor in potential future developer error when writing code? This works better with a few examples:
switch(something)
case 1: return good;
case 2: return fine;
case 3: return ...
0
votes
3
answers
168
views
Use the type returned by a function as information
Over time I become used to use the type of the returned value of a function as a piece of additional information.
For example:
A function that is supposed to return or an array if the arguments are ...