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
2answers
73 views

When should class diagrams, data flow diagrams, and flow charts be made?

When should class diagrams, data flow diagrams, and flow charts be made? After making classes or before making classes? Should data flow diagrams and flow charts be made all the time in all the ...
0
votes
1answer
24 views

Upload file to S3 or save it locally?

I have a web application that allows users to upload files. My application does processing on these files (parsing, modifying metadata, etc). What approach should I follow? Should I save the files ...
0
votes
0answers
38 views

Updating class property inside the method vs. returning a value from the method

In a large code base, what is a good practice between: Updating class properties inside the method vs. returning a value from the method and updating the property in the place where the call to the ...
0
votes
0answers
18 views

Is it a good idea to store long delimited strings in DOM?

Is it a good idea to keep long strings like base:Regular 1,optional:my_optional_plan,optional:optional_plan_2 in the DOM that could be used later when needed or should the data be brought only ...
-4
votes
0answers
26 views

Objects and Classes in Python [on hold]

Can anyone: 1. Define what an object is in programming and python. 2. What is class in programming 3. Give an example of an object in python 4. Give an example of class in python I can't seem to ...
77
votes
11answers
9k views

Does programming in general become easier to read, write and understand as you gain experience?

I'm a beginner in programming and I've been reading books, studying, reading articles, and whatnot. I'm getting great results since I've started learning programming, and when I was a beginner I used ...
42
votes
5answers
4k views

How to avoid typical “dynamic language mistakes”?

I've recently poured a couple of hours into JavaScript because I wanted to benefit from the massive userbase. Doing that I have noticed a pattern that most people attribute to dynamic languages. You ...
0
votes
1answer
60 views

How do I manage a large state graph when building a scaleable finite state machine?

Lately I've been working on a project that involves parsing a toy domain-specific-language. While building it out, I realized that an efficient way to handle parsing tokens would be to represent the ...
2
votes
3answers
141 views

Is creating “shortcut methods” in the superclass of a controller Bad Practice?

Consider the following simplified example: abstract public class Controller { protected final boolean isUserAdmin() { return getServiceContainer().getUserService().isUserAdmin(); } ...
2
votes
2answers
157 views

When is it ok to instantiate all of my objects upfront?

I am currently working with a contractor who's code instantiates a large number of objects upfront at the start of the application. This application is written in ruby, but I wonder how something ...
12
votes
2answers
345 views

Haskell ways to the 3n+1 problem

Here is a simple programming problem from SPOJ: http://www.spoj.com/problems/PROBTRES/. Basically, you are asked to output the biggest Collatz cycle for numbers between i and j. (Collatz cycle of a ...
0
votes
1answer
79 views

Seeking advice on design strategy for Java application

I'm a very new programmer developing my first application in Java as a side project for my employer. I'm a part-time student working full-time hoping to eventually score a developer job, and my ...
1
vote
3answers
189 views

Should I create .Clone() on a class or create a copy-constructor?

I'm quite unsure what I should use in C# - both should in theory do the same, but I think both are quite easely overseen. Or is there another possibility I have to take in consideration? I know in C++...
2
votes
0answers
35 views

Should I use includes or functions/methods for design elements

I have a website that was originally created as a one page application that is now morphing into a full (multi-page) site. I am trying to refactor the various design elements for reuse on the other ...
0
votes
0answers
30 views

Nested Callbacks: Best Practices for giving access?

A bit of background first: I'm creating a set of Bluetooth Low Energy services (BLEDiscoverer, BLEConnector, BLECommunicator) I'm trying to follow the SOLID principle so I'm putting each class in ...
111
votes
15answers
18k views

Are single-character constants better than literals?

I recently encountered a class which provides pretty much every single-character as a constant; everything from COMMA to BRACKET_OPEN. Wondering whether this was necessary; I read an "article" which ...
2
votes
2answers
153 views

Does the type safety of a programming language implements it binding mechanism or vice versa?

I am really confused about the concept of Strongly typed programming language (AKA type safety enforcement).Based on multiple definition from Wikipedia source I can conclude from how I understood it ...
6
votes
4answers
893 views

How can I create and manage permissions more dynamically?

I want to implement a security system into my web-based Intranet application which allows security administrators to 'fine-tune' exactly what type of access a user/role has to an object. For example, ...
5
votes
4answers
400 views

Magic numbers, locality and readability

Lately I've found myself inserting magic numbers into code to make it more readable. I've done this in situations where the magic number is only used once and its purpose is obvious from the context. ...
3
votes
3answers
1k views

Should I use foreign keys in my database if I use laravel?

I'm creating a website with Laravel for the first time. I checked relationships documentation today and it seems that Laravel just uses simple SQL queries. class User extends Eloquent { public ...
-2
votes
1answer
62 views

What is the term to describe all the instructions that executed as a result of a particular instruction?

What is the term to describe all the instructions that executed as a result of a particular instruction? main(){ if(a) call_a(); else call_b(); } func call_a(){ //do_something //sleep....
62
votes
9answers
4k views

How can I get things right at the beginning of a software project? [closed]

I am programmer with 1 year experience, recently I realized I seldom start a project correctly (most of my side project), normally the project cycle goes like Start with a few use-cases Start coding ...
0
votes
2answers
88 views

What is good practice when dealing with data integrated in the source code?

I've been tasked with overhauling a fairly large web-system that requires much user input. In an attempt to instruct the users when making input, the original creators has made extensive use of ...
1
vote
1answer
88 views

Better way to organize query methods in Android?

In my Android app I have a SQLiteHelper class that extends SQLIteOpenHelper, and takes care of things like table-creation and upgrades. SQLiteDatasource class that performs CRUD operations on the ...
6
votes
4answers
359 views

Best practice for getting last record inserted in DB

Me and a couple of colleagues are having a discussion regarding the following case: In an OrderStatus table we're keeping track of all the statuses an order goes through in time, including "Pending",...
13
votes
1answer
7k views

raw, weak_ptr, unique_ptr, shared_ptr etc… How to choose them wisely?

There is a lot of pointers in C++ but to be honest in 5 years or so in C++ programming (specifically with the Qt Framework) I only use the old raw pointer: SomeKindOfObject *someKindOfObject = new ...
22
votes
5answers
13k views

When and why you should use void (instead of e.g. bool/int)

I occasionally run into methods where a developer chose to return something which isn't critical to the function. I mean, when looking at the code, it apparently works just as nice as a void and after ...
1
vote
2answers
120 views

Best Practices for Automating Word Documents [closed]

I recently started at a company as a Automation Developer. My job is to automate periodic reports (in Word) for all of our customers (~50), one for each. Each report is slightly different, so I am ...
0
votes
0answers
59 views

Heuristics/rules for programming to an interface [duplicate]

I am struggling with applying the "programming to an interface" guideline because I can't seem to decide in which situations it is necessary and in which ones it's overkill (or even counter productive)...
6
votes
4answers
7k views

Returning null or a empty value/throw exception? [duplicate]

Various programming books suggest that methods should not return null values (Clean Code for example). Instead of returning null default values (0 or empty string or empty object) should be returned ...
10
votes
4answers
563 views

Is it bad practice to reuse method parameters?

There are times when I will need to modify a value passed into a method from within the method itself. An example would be sanitizing a string such as this method here: void SanitizeName(string Name)...
38
votes
14answers
23k views

RESTful API design. What should I return if there are no rows?

I'm currently coding an API for a social network with the Slim Framework. My question is: What are the best practices when there are no rows to return in the json structure? Lets say that this call /...
2
votes
2answers
153 views

Tag based programming

I don't know if this is a thing but here's a silly idea. Often there are cases when you have to refactor code such that you need to change code pertaining to some particular area. This may involve ...
1
vote
2answers
167 views

Is a an object Necessary or can I still use a DataTable

I'm currently working on a fund project and I have it set up so I get the holdings from my database and store in in to a DataTable to process. I've created a function where my Database results are ...
4
votes
2answers
180 views

The order of values in ? : expression

Which construction is more readable: someVariable == null ? SOME_VALUE : someVariable; // avoids negation someVariable != null ? someVariable : SOME_VALUE; // normal situation first I have to ...
4
votes
8answers
545 views

Testing loses its effectiveness if all programmers don't use them

Let's assume you are convinced that the extra time spent unit testing has merit and improves production. Does that still hold up when everyone working on the same code doesn't use them? This question ...
2
votes
4answers
271 views

Are some people just unable to code? [closed]

So for the past year or so, I've been trying to self-teach myself programming. The problem is, every time I start to try and teach myself (like on Codecademy and such) I start off great and then ...
0
votes
0answers
48 views

Designing a plugin-based platform - control vs. functionality

TL;DR I want to build a host application/framework for plugins. On the one hand I want to enable plugins to do anything and on the other hand I want to have control over them. Background I'd like ...
14
votes
6answers
9k views

What technologies are used for Game development now days? [closed]

Whenever I ask a question about game development in an online forum I always get suggestions like learning line drawing algorithms, bit level image manipulation and video decompression etc. However ...
0
votes
0answers
32 views

Debugger directions

I am running an old DOS executable file that runs a set of instructions to test an electronic component via com1 (RS-232) on a pc. The 16bit software has 8 main routines and some subroutines within to ...
26
votes
16answers
3k views

How often do experienced programmers have trouble getting their code to perform its intended purpose?

I'm kind of inexperienced with programming (ie less than a year) and I have recently been getting discouraged, mostly from not being able to solve problems with my own code (Not forgetting parentheses ...
11
votes
7answers
9k views

Non-zero exit status for clean exit

Is it acceptable to return a non-zero exit code if the program in question ran properly? For example, say I have a simple program that (only) does the following: Program takes N arguments. It returns ...
1
vote
2answers
116 views

How to do dynamic dimension for loops

I have a for loop in C# as below, int[] dim1, dim2, dim3; //Initialize dim1, dim2 and dim3 for(int i = 0; i < dim1.Length; i++) { DoSomething1(i); for(int j = 0; j < dim2.Length; j++)...
0
votes
0answers
36 views

How can incorrectly scoped variables cause issues between users/requests in web apps

I've had some errors that have arisen in a recent web app I've built that have been fixed by being more diligent in locally scoping variables. The issues happened "sometimes" as in very rarely. This ...
19
votes
4answers
645 views

Using flat files vs database/API as a transport between a frontend and backend

I've got an application which has generated a rather heated discussion between a couple of the developers. Basically, it's split into a web layer and a backend layer. The web layer collects ...
1
vote
2answers
114 views

Planning to convert PDF to JPG, Annotate the image, Reconvert to PDF

I have a feature where scanned exam answer books need to be digitally annotated and marked. The scanning portion of the work is with another vendor who refuses to scan in any format other than PDF as ...
7
votes
1answer
237 views

How do I feel more productive after programming? [closed]

I really enjoy the actual programming part of programming, and actually writing the code, and figuring it out. But on this project I've been working on, most of my time has been spent on kind stupid ...
0
votes
0answers
136 views

Any Special Practice On How To Read Code? [duplicate]

We know so much articles and best practice on how to write a better code. Class decoupling, reversible engineering decision, clear responsibility, etc. But how about best practice on how to read code? ...
1
vote
1answer
36 views

Preparing multiple serial ports with multiple TCP in my project that I can enable or disable if I want

I have intermediate level of understanding on how TCP and serial works, I've also been able to develop system that uses 1 TCP client and 1 Serial 2 Serials 1 TCP Server 1 TCP client My problem is ...
2
votes
3answers
131 views

Should I only declare the variable as integer if I can perform calculations on it?

Been thinking this for a while now, for example I have a UX that let's the user choose what IP to connect. I have numericUpDown1, numericUpDown2, numericUpDown3, numericUpDown4 to limit the user to ...