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.
5
votes
7answers
629 views
Why unused variables is such an issue?
I was cleaning unused variables warnings one day, and I started to ponder, what exactly is the problem about them?
In fact, some of them even help in debugging (e.g. inspect exception details, or ...
7
votes
3answers
226 views
How to perform input validation without exceptions or redundancy
When I'm trying to create an interface for a specific program I'm generally trying to avoid throwing exceptions that depend on non-validated input.
So what often happens is that I've thought of a ...
40
votes
9answers
6k views
Is a JS Boolean having custom properties a bad practice?
In JS you can return a Boolean having custom properties. Eg. when Modernizr tests for video support it returns true or false but the returned Boolean (Bool is first class object in JS) has properties ...
1
vote
1answer
46 views
MIT, BSD, Apache License: Create application for client
I create Application for my client. I use some libraries released on GitHub under MIT, BSD and Apache license. I create also documentation (PDF file) where I would like to point what libraries and ...
0
votes
0answers
10 views
Helper methods for JUnits logic [duplicate]
I've found a lot about creating JUnits for helper methods, where a "helper method" means usually a non-public method of a class.
I would like to ask the same question but in different context. A "...
4
votes
2answers
185 views
Using tiny number of classes from a large library
I wrote a utils library (5 KLOC) that a lot of my projects use. I've also written a very small project (150 LOC) that needs just 1 or 2 of the classes in the utils library.
I really don't want to add ...
42
votes
10answers
4k views
Acceptable to rely on random ints being unique?
I've been implementing a network protocol, and I require packets to have unique identifiers. So far, I've just been generating random 32-bit integers, and assuming that it is astronomically unlikely ...
2
votes
1answer
81 views
Using binary search in different scenarios
I have to give my one of the biggest interviews next week and I am working hard for that. I have also enrolled myself for some mock interviews for that. So, coming to the problem last day I had this ...
2
votes
1answer
102 views
Practices for navigating uncertainty in software design
Background:
So I'm trying to create my first game engine for learning purposes. After looking up a few articles I was able to design the beginning portions of my engine to at least get me going. My ...
-3
votes
0answers
53 views
Frontend to Backend workflow
Right now the frontend dev hands over static html files to the backend dev who then includes the php code. When the frontend changes this step has to be done again. What would be the right way to do ...
4
votes
5answers
187 views
Should I take the time to clean my code once it's working if it isn't clean? [closed]
Should I take the time to clean my code once it's working if it isn't clean? Cleaning can take a lot of time. My boss just need it working but I feel unhappy if my code isn't clean.
3
votes
1answer
75 views
Contract interface/class with inner classes/interfaces
Brief description of my project structure.
I have some base classes like BaseView, BasePresenter ... .
Also my project consists of modules, module represents one complete part of the application.
...
16
votes
7answers
854 views
Is it bad practice to store certain values as strings?
That's a very vague title but I couldn't think of a better way to word it. But, just as an example, think about the direction that a character in a game is moving in. It just feels kind of wrong to be ...
6
votes
4answers
332 views
What are the most effective techniques to stop a codebase from becoming difficult to maintain as it grows? [closed]
I am a software engineer of 10 years and wondered what other people have found effective in stopping a codebase from degrading over time. For example, some of the issues I have noticed are:
large ...
5
votes
2answers
270 views
Is it dangerous for a program to rely on line numbers in input data?
I recently joined a software project and discovered that the current architecture relies on line numbers of input data files. For example, the data on line 248 of an input file corresponds to file ID ...
16
votes
7answers
995 views
Should “else” be used in situations where control flow renders it redundant?
I sometimes stumble upon code similar to the following example (what this function does exactly is out of the scope of this question):
function doSomething(value) {
if (check1(value)) {
return -...
22
votes
7answers
4k views
Ninety-ninety rule in practice
The first 90 percent of the code accounts for the first 90 percent of
the development time. The remaining 10 percent of the code accounts
for the other 90 percent of the development time.
— ...
2
votes
2answers
260 views
How do programs compute versions?
I've written a command line tool and I want it to print out the current version of the program if I type in the --version command. I've got a git repository setup for my program so I figured maybe I ...
2
votes
3answers
94 views
Name for type of variable where incrementing it takes you back where you started
If I have a variable say x and set it to x=2 and then increment it, it happens in some systems that the variable after a number of increments reaches a max value and then resets back to its lowest ...
4
votes
1answer
62 views
Is there any need to have an evaluation stage for a lexer to properly work?
Wikipedia says that the lexical process is often divided into two phases. The scanning process, and the evaluation process. Wikipedia defines:
The scanning process as:
The first stage, the scanner,...
5
votes
3answers
233 views
Functions that contain single statement?
Is it OK to have functions that have single statements?
I usually make functions that have single statements. I believe these increases code readability and i am able to write code faster as they ...
5
votes
5answers
351 views
Should I ignore features of one language when I plan to port my code to another which doesn't have such features?
I'm currently toying around with a very large project. A interpreter for a simple scripting language. After weeks of planning, I decided that the best course of action would be to prototype part of ...
2
votes
1answer
113 views
Writing a library for accessing persisted DBMS data - what should I pay attention to?
I'm working on this project which, for certain reasons, will need to read the data that's persisted by a DBMS (*). The data is not serialized objects with class information, representation of pointers ...
10
votes
5answers
655 views
Is placing text markers inside of strings bad style? Is there an alternative?
I work with massive strings which need a lot of manipulation.
For example, I might generate a string like this:
Part 1 Boat
Section A Programming
Part 2 Partitioning boats for ...
4
votes
2answers
186 views
Why do I need dependency injection and the depencency inversion principal in my case?
I'm a student of best practices, architectural patterns, and design principals. I have been studying dependency injection and inversion of control a lot lately, and have been "drinking the koolade" ...
1
vote
1answer
40 views
Can a library/plugin be based on other, common, libraries in that language?
Using JS as an example here, if I am creating a library/plugin, and intend to make it available to others, should I keep it in Javascript? Or would jQuery be an acceptable dependency? At what point ...
0
votes
0answers
65 views
How to use two dependent APIs in one application
I spent the last hour reading meta if my question fits better to SoftwareEngineering or StackOverflow. I ended up that this is the place.
I am on start of developing a website (and then a mobile app) ...
8
votes
4answers
597 views
What are the responsibilties of the main in object oriented programming?
I'm new to object oriented programming and I don't understand what's the purpose of the main.
Yes, I read that it's the "entry point" of the program but what I don't understand is what should be in ...
5
votes
3answers
153 views
What is the procedure(if any) to select bytes to represent opcodes?
TL;DR
What procedure is followed when selecting bytes to represent opcodes? Are byte(s) for opcodes just randomly chosen, and them mapped to mnemonics?
I recently learned from this answer that ...
6
votes
2answers
134 views
What do you call the layer of modules that call external APIs?
I'm creating a Node app.
I have JavaScript files that include custom functions that make calls to external APIs (in this case Google APIs)
I have JavaScript files in my node app that are related ...
0
votes
2answers
80 views
Should MySQL database tables only have a single unit of information per row?
I run an automated data collection service at work, which records measurements (temperatures, voltages, etc) from about a dozen sensors at a rate of about once a second. The MySQL database table looks ...
18
votes
5answers
1k views
Aren't “deep composition hierarchies” bad too?
Apologies if "Composition Hierarchy" isn't a thing, but I'll explain what I mean by it in the question.
There isn't any OO programmer who hasn't come across a variation of "Keep inheritance ...
4
votes
4answers
407 views
Should I be using const more in C++?
There are some things I am pretty strict about, but const has not been one of them.
For example, I might make a local variable that I use three times in a function, that does not get changed, and yet ...
30
votes
8answers
4k views
Are assignments in the condition part of conditionals a bad practice?
Let's assume I want to write a function that concatenates two strings in C.
The way I would write it is:
void concat(char s[], char t[]){
int i = 0;
int j = 0;
while (s[i] != '\0'){
...
2
votes
2answers
408 views
Is coupling a good thing or bad thing when I'm developing standalone modules in a framework?
Encapsulation is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. Client code is expected to inherit from system-supplied classes and then ...
3
votes
0answers
72 views
When should bool.boolValue be used?
Recently a co-worker has taken to checking boolean values in the following manner:
if boolVar.boolValue {
...
}
These variable are generally declared explicitly as boolean types either using:
...
0
votes
2answers
108 views
Is there such a thing as a 'pseudo-compiler' for proprietary software?
I'm interested in whether there is such a thing as a pseudo-compiler that can create a kind of binary or bytecode version of a plaintext script file, which can only be accessed by a proprietary piece ...
4
votes
2answers
85 views
Entrusting third party components in your projects
How do you guys go about entrusting third party packages, libraries, etc. into your projects? In other words, what steps, if any, do you take before incorporating an outside component into your ...
2
votes
1answer
87 views
Future data integrity (n years)
So recently, I had a client ask me to restructure his Database hierarchy which consisted mainly of changing table names and column names and creating cross-references to stop red locks.
He later ...
-2
votes
2answers
120 views
Where can I find the/What are the correct steps/strategy to plan before coding? [closed]
I know how to code and get things done but almost all the time it takes me too much time to create a first working version of the algorithm/application.
I start from one part and then jump to another ...
4
votes
2answers
288 views
Practice for returning a value or equivalent variable?
I think it would be easiest to explain what I'm asking with an example.
function getLastNode() {
let current = this.head;
if (current == null) {
// Here, we could either return ...
0
votes
3answers
234 views
Mental model for working with linked list [closed]
I have been doing some practice problems on LinkedList but more than half of my time is spent on managing null pointer issue in my code, provided I have to keep track of current, previous and runners ...
2
votes
4answers
348 views
Data first or code first?
I have seen many questions on whether to design data first or code first when designing a new application. I wonder if some have the same conclusions/ideas as me. I come from painting/digital design/...
-1
votes
2answers
64 views
Does Multithreading help in web scrapping?
To my knowledge multi-threading is just an illusion since CPU schedules time for each of the process. So when scrapping at a particular time, only one content from the website will be scrapped and it ...
1
vote
0answers
23 views
Structure to store resources in SCM repository
I have 3 artifacts for my application as below.
One Jar file
sql scripts
Templates
I need to bundle all 3 as part of a snapshot bamboo build that uploads them into a repository. Is there any known ...
0
votes
0answers
56 views
Invent custom filename extension for derived format
Say I use a predefined serialization format X for certain data. Should I indicate the application in a custom filename extension or not? It is quite common
pk3 is a zip archive
XSL, SVG and many ...
5
votes
1answer
189 views
Log off system on all devices
On websites like Facebook and Twitter, you've got a function to log off on all devices. How does it work?
Does it work with IP addresses or something? What happens when you login on a device and use ...
0
votes
0answers
47 views
What is best practice for building your app on top of 'starter' code someone else prepared?
I want to build Angular2 application on top of angular2-webpack-starter. After pulling this repository, I'm going to add my own app code and commit many changes. Also, developers that built angular2-...
-1
votes
1answer
76 views
Can I use python 3.5.2 on my machine for development if the client is 3.4?
Here is the situation, I wish to use the last programming language of ruby, python and some more on my development machine, but the server where it will be is not last version of that programming ...
-1
votes
1answer
41 views
New project development & git guidlines and hints [closed]
We are two senior students and we want to develop an app.
Although we dont have experience on using git & github.
Our app will consist of a server handling requests with a mongoDB database. The ...