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.
6
votes
4answers
207 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 ...
-6
votes
1answer
38 views
How to program a Intelligent agent to understand chemistry [on hold]
I was wondering if anyone could help me with this particular question, I'm working on making a intelligent agent to understand chemistry, the intelligent agent I'm using is a Utility Based Agent and I'...
3
votes
2answers
159 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
38 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
49 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) ...
7
votes
4answers
531 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 ...
0
votes
1answer
86 views
Implement someone else's project [closed]
I saw a video on reinforcement learning that shows the simulation of a car on a track using 5 sensors, and its code is published on github. Now, i want to implememt (my own implementation, not using ...
4
votes
3answers
101 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 ...
4
votes
2answers
90 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
75 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 ...
16
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
379 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 ...
29
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
367 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
65 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
105 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
82 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
85 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
116 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
283 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
229 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
332 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
50 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
19 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
55 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
181 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
45 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
71 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
39 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 ...
1
vote
1answer
133 views
const variable inside a c++ interface
Can I have const variable in a c++ interface?
Is it valid as part good design? (Not wrt syntax but as per good practices).
For example, if I want a class interface "modellable" which is implemented ...
1
vote
1answer
49 views
Should I give users the ability to 'unreport' on a forum
(I really hope this is the appropriate place for a question like this. Nevertheless, I hope some of you can give me your opinions, regardless).
I am building a forum with Laravel. Progress has been ...
-1
votes
1answer
96 views
Where does Firebase fit in?
I am a front-end developer who is familiar with HTML, CSS, JS and to a degree, AngularJS.
I've chanced upon Firebase (firebase.google.com) - and was wondering if I could, with my lack of knowledge ...
0
votes
1answer
64 views
Best practice for Managing 1200 Counties data for 56 states
I have a complex problem to be solved, I have several excel files containing data from over 1200 counties from 56 states. Problem is that most of the counties has some columns which are different from ...
3
votes
2answers
160 views
Is it good practice to use array.pop() assignment in a while loop condition?
Just saw a code snippet that used an array pop assignment in the while condition; was wondering if this is acceptable/good practice?
var arr = [0,1,2,3,4,5];
var current;
while (current = arr.pop())
{...
20
votes
8answers
3k views
Lie 2: Code should be designed around a model of the world? [closed]
I recently read the Three Big Lies blog post and I am having a hard time justifying the second lie, which is quoted here:
(LIE #2) CODE SHOULD BE DESIGNED AROUND A MODEL OF THE WORLD
There is ...
76
votes
11answers
9k views
Shouldn't unit tests use my own methods?
Today I was watching a "JUnit basics" video and the author said that when testing a given method in your program, you shouldn't use other of your own methods in the process.
To be more specific, he ...
0
votes
1answer
106 views
Is declaring 'const' variable a good programming practice? [duplicate]
Is it a good practice to declare all the variables in my program as a const variable?
eg:-
private int myAge = 20;
private const int Age = 20;
Now, from the above example, which one is a ...
6
votes
5answers
312 views
How can a programmer know whether he has to program a method or search for it in a library? [closed]
I am a beginner programming in Java. And when confronted with a new task I wonder whether I should code the function or search for it.
For example, if I want to calculate 10!, or cos A, I reckon that ...
3
votes
1answer
56 views
Functional testing of incomplete features
I've had several tasks where I'm to do functional testing (and to be writing automated test scripts) on features that are not actually complete.
For example, CRUD testing on a project to make sure ...
0
votes
3answers
58 views
If field is required when inserting data, should I check if null when retrieving?
If some fields are required when inserting data, should I check if null when retrieving them (suppose I need to do something with this fields that may throw exception if null), or I shouldn't unless I ...
0
votes
2answers
60 views
Validation for each record in csv file
I create page to import records so users can import records using a CSV file.
I am already using Sanitization to remove unexpected characters for specific field of the record, Do I have to validate ...
0
votes
0answers
82 views
How to clarify the control flow when dealing with many callbacks?
Traditional programming could be done quite readable. Like this:
FUNCTION do_HTTP_request(url) {
if(!ask_user_if_he_wants_to_connect()) return;
if(!network_is_enabled()){
...
4
votes
3answers
155 views
Should the developer provide steps/directions for SQA?
New to the field of QA, I've been asked to do SQA for a project that I'm unfamiliar with and that is close to completion. An example of a specific functional task to be tested looks like the following:...
3
votes
3answers
181 views
Is it good practice to create interfaces that limit usage?
So I'm coding a way to send events to multiple clients, and then having the clients decide how they want to handle it. I'll exclude the bits that don't lend themselves to explaining the situation.
...
1
vote
1answer
90 views
What is the best way to incorporate new language features into your code? [closed]
My main language is currently JavaScript, and I'd say I'm fairly proficient in it. That is, when I think "I want to do x", I don't (generally) Google "how to do x", but I think "I know! I will use ...
0
votes
1answer
166 views
C++ Basic Rotation Question
I've got a problem and I haven't yet found an explained solution to get it drilled into my head:
I want my object to make a basic rotation TOWARDS the mouse cursor, not the lock-on.
I know it must be ...
4
votes
2answers
176 views
Specification pattern and open closed principle
I'm studying the SOLID principles and I'm having some troubles dealing with the Specification Pattern and the open/closed principle.
The fact is that the Specification pattern introduced by Eric ...
3
votes
1answer
1k views
Why is Lustre used for programming critical control software (Nuclear power plants etc)?
So, as stated on wikipedia:
Lustre is a formally defined, declarative, and synchronous dataflow
programming language for programming reactive systems. It began as a
research project in the ...
-2
votes
4answers
74 views
Multiline formatting of long function signatures/calls [closed]
Let's say you have a signature like so:
public void MyFooBar(IExtraSuperLongTypeName param1, TypeA param2 ISomeotherReallyLongTypeName param3, TypeB param4, TypeC param5)
Formatting in on one line ...
0
votes
0answers
86 views
Close-distance phone location network
I want to design a network in which multiple devices (phones or tablets) very close to each other (between 0.5-20m) will locate themselves in a map shown in each of the devices' App.
Known that:
...