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

-1
votes
0answers
25 views

Python Gmail app password [on hold]

I offer this as a "hey look what I found" and not a question. I had my Gmail username and password in plaintext in a python script that sends me notifications. Fearing it could become compromised, i ...
-4
votes
0answers
29 views

What are some best practices for converting a codebase from Matlab to C using MATLAB Coder? [on hold]

I am starting a project to convert a medium size Matlab codebase (~100 files, total of ~10K LOC) into C/C++. (That is, the end product needs to be runnable without Matlab.) I have been reading ...
1
vote
1answer
110 views

The Better Parts and Delegation: Is Crockford Too Extreme?

Douglas Crockford has recently been giving a talk called The Better Parts. The gist of the talk is that JavaScript developers should actually avoid a superset of the The Bad Parts, which now includes ...
-1
votes
0answers
77 views

Redundant ElseIf-Else Blocks

These types of if-elseif-else blocks appear all over the place, and in no small number (so the less the better). Every time I have to think and decide: Do I want the simpler or the more thorough of ...
0
votes
1answer
66 views

Sending Out Functions To Return Or To Die

Which is preferable for both solid technique and secure coding? Example #1: function_one() blah; function_two() blah; print blah; exit; ... Example #2: ...
-1
votes
0answers
57 views

Should I use the at symbol (@) in my php code [migrated]

I have recently learned how to use the @ symbol in my php code and I have learned to love it. However I have also been told that @ is not efficient performance wise. Is the elegance it provides enough ...
4
votes
2answers
219 views

Is it better to use strings or int to reference enums outside the java part of the system?

We were having a discussion at my work about the use of enums in Java. A coworker was arguing that when using enums on the server-side, whenever required we should use string to reference to it (for ...
-3
votes
2answers
123 views

Is worth to read The Clean Coder book If Pragmatic Programmer is already read? [closed]

Some weeks ago I read The Pragmatic Programmer by Andy Hunt, and I want to know if The Clean Coder book by Uncle Bob will give me some improvements about a recommended attitude and practices to be ...
2
votes
1answer
60 views

Returning the object/$this [duplicate]

A very general question. I was thinking about method chaining, which seems useful, and began wondering if there is a reason to not return the object in a class member, as a matter of course. For ...
1
vote
1answer
79 views

Is there a common set of best practices for passing anonymous functions as arguments?

This is a generic question about using anonymous functions as arguments to other functions. I give an example in Python, but the question is not about Python (and I'm particularly interested in ...
0
votes
3answers
91 views

Coerce bad input or always crash early

The general consensus seems to favor the Crash Early approach, the most reputable source being the acclaimed Pragmatic Programmer book. And while I understand and agree with the advice in many ...
0
votes
0answers
74 views

What is the best way to remember a successful execution over several program calls?

I'm working on a build process, that is called manually over the command line. To check if it exited unsuccessfully during the build I want to set a lock file (symbolic link) and remove it on ...
0
votes
2answers
49 views

Should I use ASP .resx resources if the website is available in a single language?

Is it a best practice to always store strings in ASP .resx resources files, even when the application is not localized according to the user culture ? (Web pages will be displayed in french.) Is there ...
2
votes
1answer
71 views

Enforcing manual inclusion of a specific header file (banned.h)

Banned.h is a list of ANSI C functions that Microsoft is trying to persuade programmers to deprecate. I already know how to enforce automatic inclusion of banned.h (such as the answer to Ensuring that ...
3
votes
3answers
196 views

Best OOP Practice in C#: Passing the object as parameter VS creating a new instance of the object

First things first, I would like to know if passing an object as parameter is much better than creating another object AGAIN in a class that will use it again and second what are the pros and cons of ...
6
votes
1answer
517 views

How can I tell when a program argument should be a configuration variable?

In simple cases I can see right away which direction to go. If I'm passing a working directory to my program, and it's the same for the vast majority of the runs, make it a configuration variable. ...
50
votes
7answers
2k views

Code First vs. Database First

When I design and create the software I work on, I typically design and create the back-end SQL tables first and then move on to the actual programming. The project I'm currently working on has me ...
1
vote
1answer
49 views

Who is responsible for stream positioning?

The samples in question are c#, but it applies to any language. If you have a function which reads content from a stream. Who should be responsible for ensuring that the stream position is correct ...
0
votes
1answer
71 views

What are the key areas to evaluate software (codebase) on? [closed]

I have been asked to do a code review of about 50 applications over a period of 6 weeks. (Management has changed and the new CTO asked for an full internal software audit) I am wondering, what are ...
3
votes
1answer
102 views

Is console logging inappropriate for chatty applications?

12 Factor states that applications should log to the console, those console logs should should be unbuffered, and the logs should be redirected to someplace useful (file, database, whatever). But ...
2
votes
1answer
66 views

Under which circumstances does it make sense to lose track of where an exception was thrown from?

Is there any valid reason why a catch block on a lower layer would throw back an exception caused by a higher, unknown layer using the following syntax: throw ex; ... rather than: throw; ... ? ...
0
votes
1answer
48 views

Advice needed on rethrowing an exception

Consider the following c# code: public class ExceptionManager { public static void TreatException(Exception ex) { if (ShowAndContinue(ex)) // display a user-friendly ...
18
votes
8answers
2k views

Is it normal for a programmer to not have 100% clarity over their own code at times? [closed]

I'm not an expert programmer so this may be why, but I've come to notice that whenever I create complex code (like a Chess game I recently made), I am able to write the correct code to get the program ...
0
votes
0answers
27 views

Manual repetitive conversion between file types

Let's say i have an interest in file conversions, but everything should be made by hand and i have multiple output formats (say: csv and excel). Once i get contacted by a client, i have to link ...
4
votes
1answer
283 views

How to move php documentation closer to standards?

I have an large php project. I used to document it with NaturalDocs, but I didn't include the documentation generation in the build process for a long time ( years ). I recently started using ...
8
votes
5answers
587 views

How to do Test Driven Development

I have just 2+ years of experience in application development. In those two years my approach towards development was as following Analyze requirements Identity Core component/Objects, Required ...
3
votes
1answer
92 views

Bringing coding best practices for non programmers (economists) [closed]

I now work in a team of economists, many of them specializing in a branch known as econometrics, that is heavy on statistics. I am the sole engineer on the team. They make use of EViews(a ...
1
vote
0answers
108 views

Program Architecture: How to manage objects that are interdependent

Consider the following case, image I making a simple chat program; I want it to be extensible such that it would be fair easy to add add different scripting and user interfaces. I want the core ...
3
votes
2answers
190 views

How and Why should class modifiers enforce or prevent inheritance and the ability to override

This isn't really related to anything I am working on currently, its more of a question I really couldn't find an answer for. Class modifiers like MustInherit or NotOverridable to me, seem like they ...
3
votes
3answers
323 views

Should we add constructors to structs

We often use c++ structs to define data structure as opposed to class which can be a complete module with member methods. Now deep down, we know they both are the same (loosely speaking). The fact ...
2
votes
5answers
84 views

Using DDL commands in programming language [duplicate]

Hello I am a student with no industry experience. My question may sound dumb, but, me and my friends were having discussions on use of DDL directly in programming language (any language may be Java, ...
-2
votes
2answers
176 views

Why doesn't array declaration guarantee proper memory allocation whereas malloc does? [closed]

In C++, when I declare an array like int array[10];, it sometimes uses memory assigned to other variable where as this problem is non-existent when I use an integer pointer and malloc to allocate ...
32
votes
6answers
6k views

Code that converts a value into a different representation, then converts it back to where it started is bad, but how? [closed]

I was reading an article about bad programming practices. It mentioned - "Yo-Yo code" that converts a value into a different representation, then converts it back to where it started (eg: ...
19
votes
5answers
583 views

Is staying implementation agnostic really worth it?

I have a project that I'm working on currently using Tomcat, Spring 4, Spring Security, MySQL, and JPA w/ Hibernate. I picked JPA from the standpoint that it's suppose to make swapping out the ...
0
votes
0answers
22 views

Add new/modify existing callback to/in API

I am working on a common API for a user interface. My colleagues use this framework in all their projects, but the UI is not our main aspect here, so the knowledge of the UI framework is somewhat ...
4
votes
1answer
485 views

How dangerous is it to take shortcuts when coding Web based applications? [closed]

I started working as a Web developer few months back. Previously, I had no prior professional experience in programming besides school classes and fun-side projects I did on my own. I am the only ...
0
votes
1answer
120 views

Method Parameters Ordering [closed]

I was recently changing a method to add in an additional parameter, and I couldn't help but wonder if there were "best practices" or "generally accepted rules" in deciding what order parameters of a ...
3
votes
1answer
109 views

Difference between patterns: Specification, Guarding, Conditions, Monads, Validation,

I'm currently trying to get my head around a few patterns (especially the ones mentioned in the title above) that are made to address different problems and are being used in different parts of the ...
3
votes
9answers
712 views

Is it better to have separate functions or add more arguments to a function? [closed]

Which is the better style to follow for say, changing the voltage on a 4 channel PSU: setChannelOneVoltage(voltage) setChannelTwoVoltage(voltage) setChannelThreeVoltage(voltage) ...
36
votes
9answers
5k views

Is creating subclasses for specific instances a bad practice?

Consider the following design public class Person { public virtual string Name { get; } public Person (string name) { this.Name = name; } } public class Karl : Person { ...
0
votes
1answer
106 views

translating a list of words (word1, word2 and word3) [closed]

We are trying to globalize an application and we have run into a situation where I'm not sure how (of if) we would go about formatting the string for globalization. It's a paragraph explaining ...
4
votes
2answers
224 views

@SuppressWarnings in coding test submission

I am working on a coding test for an employer. It is not a particularly hard question but I am trying to do it as well and technically correctly as possible for obvious reasons. I ran into a problem ...
3
votes
1answer
218 views

How big are the teams where you have worked? [closed]

Anyone have numbers on how big a "traditional" software teams are across the industry? At what point do big companies like Microsoft, Facebook, Google, etc. split teams of developers up? Agile books ...
0
votes
1answer
222 views

When should a class be final? [duplicate]

I've only really seen this on Java's wrapper classes (String, Integer, etc.), but never in open-source projects, and I was never taught about it in any books or classes. I know it means the class ...
0
votes
2answers
81 views

How to predict a future simulation state

We have a program that combines the simulation of an aircraft system and predefined pedagogical scenarios for trainee pilots to learn how to use this system. When we follow the normal scenario, ...
0
votes
5answers
232 views

Breaking a function into smaller ones is great… except for what about code-folding? [duplicate]

I'm currently reading Robert Martin's Clean Code book. So far I'm enjoying it. Martin talks a lot about separating long functions into short functions, each doing exactly one thing at one level of ...
28
votes
8answers
1k views

Is it okay to use exceptions as tools to “catch” errors early?

I use exceptions to catch problems early. For example: public int getAverageAge(Person p1, Person p2){ if(p1 == null || p2 == null) throw new IllegalArgumentException("One or more of ...
0
votes
3answers
99 views

Does it make sense to have a separate init function?

I'm created an opaque type and I have two options for its management. The first looks like this: type_t *a = type_init(); int err; err = type_do(a, "foo", "bar", FLAGBIT1|FLAGBIT2, NULL); if (!err) ...
0
votes
2answers
59 views

Should `setX(Object o)` methods perform deep or shallow copies of objects?

My particular situation is related to Java, but I believe this is a more general OOP question than just Java programming. The Question: Should "mutator" methods perform deep or shallow copies? An ...
1
vote
1answer
103 views

Standardization and official guidelines for C++ template parameter naming [closed]

What are some explicit and official guidelines or standards for template parameter naming in C++? I've done something like this in the past: template<typename TContainer, typename TKey> void ...