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.

learn more… | top users | synonyms

0
votes
0answers
28 views

How to structure a SaaS application?

The Problem I need to develop a Software-as-a-Service application, that will be used from our clients. The application contains a lot of forms (Company Application) using a step-by-step forms. They ...
0
votes
0answers
18 views

Craigslist-like email relay system - or internal messaging system? [on hold]

A client wants an app, where users can email each other without revealing their actual emails. So we've come down to 2 options: Email relay system, much like Craigslist Custom messaging system ...
-2
votes
0answers
55 views

Reading Code Documentation [closed]

I have been studying computer science for a year and a half, and even after 5 programming classes plus my own studies I have yet to understand how does one go about reading source code on github ...
2
votes
1answer
151 views

How do you troubleshoot an issue that you simply can't duplicate? [closed]

I have a client that keeps reporting a certain issue that users are experiencing with a public-facing site written in MVC and hosted on Azure. It seems to happen at random, but for the life of me, ...
1
vote
1answer
75 views

When to use absolute path? [closed]

I had given an answer on SO, the question was concerning a problem with a relative path. My answer was to use an absolute path, which I thought seemed simpler. The asker claimed to need a relative ...
6
votes
3answers
456 views

Is using hashes for primary keys a good idea?

The Austrian electronic ID card relies on the so-called sector identifiers. For example a hospital gets to identify a person by getting a sectorId for that person, which is computed roughly as ...
4
votes
1answer
60 views

Makefile for library project to be able to compile the unit tests and the demo program using make

I am new to makefiles and I am developing a (non-executable) library in C++. Additionally to the library I have (executable) unit tests and an (executable) demo program. I would now like to be able ...
1
vote
1answer
63 views

Should I use autoloaders in modules?

Lets say I'm running a PHP app like Magento, PrestaShop. Now these system have their own complex autoloaders to load controllers based on routes, required classes, models, etc. Most of the time as a ...
0
votes
1answer
87 views

Adding centralized logging mechanism to Project (Best Practice)

I want to add a logging mechanism to my project but I am afraid to have logging code spread all over the place. I thus had the idea of having only one class Logger responsible for writing relevant ...
0
votes
0answers
74 views

Why are scriptlets considered bad practice in JSPs when much more popular languages such as PHP seem not have any problem with them? [duplicate]

Why is doing <% if(blahblah) { //do something } %> in a JSP considered to be bad practice when noone who writes PHP seems to have any problem with doing essentially the ...
1
vote
4answers
218 views

Should I Include PHP code in HTML or HTML in PHP?

What is the best practice, to write my PHP code inside my HTML code or HTML inside PHP? PHP inside HMTL: <p class="lead">Welcome to the <?= COMPANY_NAME ?> website.</p> HTML ...
1
vote
1answer
78 views

Git Question: What to do when multiple people working on a project?

I made a project and put it on github, it's basically a small powershell function that is pretty useful in some situations. I've since made some improvements to it to add functionality...but someone ...
2
votes
1answer
140 views

Is it safe to use old code in a new project? [duplicate]

Here is the situation: While working by company A on project A you developed a very fast and perfect search algorithm. Then you switched to company B to work on project B which is totally different ...
-2
votes
2answers
141 views

Is it ever overkill creating classes/objects? [duplicate]

I just learned how to create a class or object in C++ and I'm practicing and learning. I'm writing a text based version of a popular board game and I was wondering if it's overkill creating a class ...
12
votes
3answers
408 views

Appropriate to put known issues directly in software?

I've taken over maintenance of an Android app, and there are a few residual problems that I've more or less fixed, but still have issues because of different Android OS versions. For example, sending ...
1
vote
1answer
65 views

Should I put stack trace in error files and halt my app with user friendly error [closed]

In my earlier project I wrote an app that is used in-house. My usual practice is to capture errors/exceptions from different classes and threads and put them in different log files corresponding to ...
-1
votes
2answers
222 views

Why is it so difficult to read code? [closed]

Give me a task, and I deliver. If you want an app that does this and that, I can fix that for you. But if someone else does the job, and shows me the code, I am often lost. It is very difficult for ...
0
votes
1answer
77 views

Should I put the parameters in constructor or in method? (Python 3)

I have the following code: def __init__(self, vocable_file_path, xsd_file_path, word_list_file_path): self.vocable_file_path = vocable_file_path self.xsd_file_path = xsd_file_path ...
31
votes
6answers
4k views

Is throwing new RuntimeExceptions in unreachable code a bad style?

I was assigned to maintain an application written some time ago by more skilled developers. I came across this piece of code: public Configuration retrieveUserMailConfiguration(Long id) throws ...
2
votes
2answers
109 views

Final steps of wrapping up a Python script into a program

I finished building a Python script containing eight functions which download files, extracts them, manipulate and analyze their data and then produce graphs and export them into PNG files. The ...
2
votes
1answer
216 views

How often should RAII be used? [closed]

I've been attempting to learn C++, but it is famously plagued by bad tutorials. I learned about a clever little trick called RAII (Resource Acquisition is Initialization), where one wraps a heap ...
6
votes
5answers
1k views

C++ Iterators: Best practice to represent end of range - Last or Beyond-last?

I am writing a library which deals a lot with sub-sequences of ordered containers. So for example I have a container (1,2,3,4,5,6) and a user wants to access (3,4,5). I am providing the subsequence ...
2
votes
0answers
42 views

tracking branch relations with Git [closed]

here is my workflow. I have master as the most complete version of the program. If I want to add a feature I'll create a branch named with -feat as a suffix. as bugs come up, I'll create new branches ...
-1
votes
2answers
87 views

Creating Objects from a JDBC ResultSet, best practice? [closed]

I'm still in the process of learning JDBC and web services (currently forced to work with SOAP, but more interested in REST). I want to save each table row from the ResultSet in it's own object. There ...
0
votes
1answer
102 views

Modular programming practices

As I start to code more and more, for example in C++, I tend to also want to learn more about the accepted standards for code. I'm trying to code a chess engine right now, but I'm unsure how to treat ...
0
votes
0answers
49 views

How to write class libraries that work with DB

I have programmed a library in C#, which process some EDI into meaningful data based on the DB structure of a table. I have used a typed dataset in the class library project. Now I run into an issue ...
2
votes
1answer
94 views

In C#, is it good practice to use implicit numeric conversions from int to float?

For example: if(5.0f > 1) { } Does it have a significant performance penalty? Compared to just doing if(5.0f > 1.0f) { }
31
votes
5answers
5k views

Bad practice - switch case to set environment

In the last three years that I have worked as developer, I have seen a lot of examples where people use a switch statement to set the path (both in back-end and front-end) for a URL. Below is an ...
4
votes
4answers
126 views

Creating two-way object references and keeping data integrity

I have two different classes; a Player and a Group. I need to be able to query a Player which Groups they are registered to (player.getGroups()), and which Players are registered to a Group ...
-2
votes
1answer
62 views

Programming to an Interface and Keep Testability in Unique Classes [duplicate]

I try to program to an interface whenever possible, but when I have a class that fulfills a very specific and unique purpose, one that can't be abstracted. Is it correct for me to say that I've ...
1
vote
3answers
62 views

Programming to an Interface and Interface Segregation in the Context of a User Class [duplicate]

I try to program to an interface whenever possible, but its not clear to me how I could apply it to a model as broad as a user. Which can hold many disparate fields (name, age, phone number, ssn, ...
0
votes
1answer
51 views

Logging private data

In general, I write a debug log whenever one of my functions is entered, including the parameters. For instance: function execute_query($query, $conn_string) { ...
0
votes
2answers
100 views

guideline on void methods that do not throw exceptions

In our codebase I saw a method that is similar to following: public void doSomething() { try { ... } catch (Exception e) { ... //log something ... } } ...
1
vote
1answer
38 views

Filtering additions to a list

Hopefully Iʼm posting this in the right SX, and Iʼve tagged it correctly. I have a legacy system that Iʼm making additions to which contains a custom list object. This list object can contain two ...
5
votes
1answer
126 views

Modern Interpretation of the Unix Philosophy of “Rule of Generation”

According to Wikipedia, Eric S. Raymond said that one of the 17 Rules of Unix is the "Rule of Generation", stating that: Developers should avoid writing code by hand and instead write abstract ...
0
votes
6answers
120 views

Would you create a specialized type just to wrap a primitive? [duplicate]

Often times in programming, we need to represent some value which can easily be represented using a simple primitive type. For example, in a game we might need to represent the velocity of a moving ...
1
vote
3answers
95 views

Using auto-increment clustered key and guid primary key together

My boss is the db administrator in a new software project and he came up with that design where every table will have both a auto-increment clustered key and a guid primary key (or possibly composite ...
0
votes
0answers
45 views

What are some common patterns for managing a polyglot persistence layer?

I am pretty interested in the idea of using multiple datastores to support a single application and understand the benefits in theory but would like to know a little more about how things are done in ...
2
votes
2answers
137 views

WCF service with methods to fetch data

I'm planning on building a WCF service that will fetch data entities from a Sql Server database. And I'm currently struggling with best practices issues. The thing is that there's a few different ...
6
votes
2answers
187 views

Is there something peculiar to Matlab or Mathworks that supports so much “undocumented” code?

I've been drilling into a lot of Matlab recently trying to interface with an in house algorithm engineer's work to modularize it for use in a test bench outside his suite of applications. I've come ...
1
vote
1answer
67 views

Rails validation: Which method is preferred

In Ruby on Rails there are two ways to validate, for instance, the presence of input fields. Say I want to make sure the user has filled out my fields called value and name. I could put in my model ...
1
vote
3answers
81 views

When is a event listener invoked during program execution?

I am using the Obervable-Observer Pattern. MyClass extends Observable{ invokeListeners(){ doSomething; setChanged(); notifyListeners();//This invokes onUpdate() in "implements ...
16
votes
2answers
362 views

Has variable width types been replaced by fixed types in modern C?

I came across an interesting point today in a review over on Code Review. @Veedrac recommened in this answer that variable size types (e.g. int and long) be replaced with fixed size types like ...
3
votes
3answers
153 views

How to maintain modularity in C?

I am writing C code with multiple modules like LCD display, flash memory, and GSM module etc. The project consists of thousands of lines of code, in different files. The behavior of the system can be ...
6
votes
2answers
1k views

What is the difference between function() and function(void)?

I have heard that it is a good practice to write functions that do not receive anything as a parameter like this: int func(void); But I hear that the right way to express that is like this: int ...
3
votes
2answers
133 views

What is a proper way to chain instructions if previous one is ok [duplicate]

I'm currently working on a big file I have to parse and process and each step needs to be done in an order as I do SQL queries and need inserted IDs to make other insertions ... The problem is I often ...
0
votes
0answers
63 views

Implementing peristent events using WCF-MSMQ

I am implementing a WCF-MSMQ based message queue that will follow the pub-sub model in which multiple publishers would publish an event and multiple subscriber would listen to it i.e a many to many ...
32
votes
9answers
4k views

Why would a program use a closure?

After reading many posts explaining closures here I'm still missing a key concept: Why write a closure? What specific task would a programmer be performing that might be best served by a closure? ...
2
votes
1answer
148 views

C Module - Where to put prototypes and definitions that do not belong to the public interface?

Since I am mainly an Electrical Engineer, forgive me if I am somewhat off with some terminology. I am currently programming a display driver/interface module. And like so many times before, I have ...
3
votes
4answers
875 views

If possible, would it be a bad practice to use Nullable for non value types?

Update After writing this question I found out that Nullable<T> has a type constraint of struct on T so you cannot actually use Nullable for reference types. However, some good answers ...