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
vote
2answers
316 views

Need some advice and feedback on my code's design

I am looking for feedback on the design of my program. I have a shell script call function.sh that defines a lot of helper functions. My intent is to use those bash functions defined in functions.sh ...
4
votes
3answers
499 views

Renaming long named method in C# [closed]

I'm working on a project where exist one method with title string ValidateNewPasswordExpireCurrentPasswordAndCreateNewPassword(...) I'm sure the method name must be changed. But can't found good ...
4
votes
3answers
1k views

Why should we use externalized property files for an application?

I am currently working on a rails project and have a requirement where I want to be able to map a country name's initial letters to its ISD code. eg: IND => 91, USA => 1, etc. The broader question ...
7
votes
2answers
798 views

POST/Redirect/GET with invalid form submission?

In the field of web development, is it good practice to do a POST/Redirect/GET when fields in a form submission are invalid, as well? Typically, no sensitive transaction would have taken place, in ...
13
votes
6answers
6k views

What *are* the programming concepts I should master to have a deep understanding of my craft (programming)? [closed]

In order of importance, if its possible to do so and it may not be, what are the most important foundations of knowing how to program. Algorithms, iteration, recursion, etc? Note that where I put etc....
7
votes
4answers
9k views

Replacement for instanceof Java?

So I'm fairly new to programming in the real world (outside of academic projects) and have come across lots of posts saying that using instanceof is a bad thing to use to determine what class a ...
17
votes
5answers
3k views

Descriptive naming vs. 80 character lines [closed]

I frequently hear these two valuable programming practices: (1) lines of code should be 80 characters or less and (2) use descriptive names for variables, methods, classes, etc. I understand the ...
4
votes
2answers
137 views

Unit testing markup building logic

I'm currently writing a library of helper functions to produce some repetitive markup. I have a reference to the markup the functions should produce, but I'm curious about how I should go about unit ...
31
votes
6answers
144k views

Is initializing a char[] with a string literal bad practice?

I was reading a thread titled "strlen vs sizeof" on CodeGuru, and one of the replies states that "it's anyways [sic] bad practice to initialie [sic] a char array with a string literal." Is this true,...
6
votes
3answers
205 views

Holding mutable data in a single place

Given a mutable property, it generally makes sense to only hold/store that property in a single place. When the data needs to change you only need to update a single field, and you can completely ...
3
votes
1answer
183 views

serving static or dynamic web-content based on user group

I need help understanding a problem I have, and that others surely have had as well. I'm working on a web-application that allows users to interface with a database. The application in general has ...
8
votes
2answers
606 views

Can I ask the job interviewer to show me their code before joining the company? [duplicate]

Possible Duplicate: Asking for a code sample of the company at an interview Last year I changed jobs twice.. In the interviews with the companies, everything was so ideal and perfect. Latest ...
4
votes
1answer
471 views

How to handle the input file provided in programming contests?

In programming contests like Google CodeJam, Facebook Hacker Cup, each question is provided with an input file for testing one's code for that program. I get struck at this point only. I don't ...
2
votes
3answers
430 views

Does the use of personas in Agile have any value during implementation?

This is about the use of personas, primarily in the agile development realm. What value, if any, do personas give during implementation? On agile modeling, the discussion about personas remains in ...
19
votes
5answers
5k views

Is every number in the code considered a “magic number”?

So every number in the code that we are sending to a method as an argument is considered as a Magic Number? To me, it shouldn't. I think if some number is let's say it is for minimum length of user ...
6
votes
4answers
890 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, ...
43
votes
9answers
17k views

Should the methods of a class call its own getters and setters?

Where I work I see lots of classes that do things like this: public class ClassThatCallsItsOwnGettersAndSetters { private String field; public String getField() { return field; }...
9
votes
4answers
3k views

What are the differences between algorithms using data structures and algorithms using databases?

The General Question What are the differences between algorithms using data structures and algorithms using databases? Some Context This is a question that has been bugging me for some time, and I ...
3
votes
1answer
2k views

How to create view models - Constructor, Factory Method, …?

I'm trying to lead a charge for re factoring our rather bloated controllers. We currently have a BaseModel from which all our other models inherit. The BaseModel contains things common to all pages, ...
0
votes
2answers
175 views

Custom error handling

I'm trying to figure out the best way to handle custom errors in my application. Option 1: if(expr) { } else { $_SESSION['error'] = "Some message describing the error"; } Option 2: if(expr) { ...
8
votes
3answers
441 views

Would it be better to have extra checks, or would it be a waste of time? [duplicate]

In your opinion, do you think it is a waste of time to make checks that you know there is no possible way of it being there/not being there, or would you just put it there just in case there is a bug ...
1
vote
1answer
1k views

Static Tables vs Dynamic Entity Attributes Storage Configurations

I am trying to figure out a better way to decide table storage configurations whether it will use static configurations using tables or dynamic configurations using EAV (entity-attribute-value) When ...
1
vote
1answer
217 views

How does a competition like Rails Rumble Work?

I am not sure weather it is a proper question to ask out here but it is really bothering for a while. As the official website writes: The Rails Rumble is a distributed programming competition ...
4
votes
2answers
4k views

JavaScript and callback nesting

A lot of JavaScript libraries (notably jQuery) use chaining, which allows the reduction of this: var foo = $(".foo"); foo.stop(); foo.show(); foo.animate({ top: 0 }); to this: $(".foo").stop()....
8
votes
7answers
826 views

Is it appropriate for a class to only be a collection of information with no logic?

Say I have a class Person that has instance variables age, weight, and height, and another class Fruit that has instance variables sugarContent and texture. The Person class has no methods save ...
5
votes
3answers
804 views

Multiple parameters vs single parameter(object with multiple properties)

I have an Entity Student with following properties - (name, joinedOn, birthday, age, batch, etc.) and a function fetchStudents(<params>). I want to fetch students based on multiple filters. In ...
10
votes
7answers
6k views

Is it a bad practice to include all the enums in one file and use it in multiple classes?

I'm an aspiring game developer, I work on occasional indie games, and for a while I've been doing something which seemed like a bad practice at first, but I really want to get an answer from some ...
173
votes
17answers
11k views

How do you balance between “do it right” and “do it ASAP” in your daily work? [closed]

I find myself pondering over this question from time to time, again and again. I want to do things the right way: to write clean, understandable and correct code that is easy to maintain. However, ...
4
votes
3answers
569 views

What is the best practice, point of view of well experienced developers [closed]

My manager pushes me to use his self defined best practices. All of these practices are based on is own assumptions. I disagree with them and I would like to have some feedback of well experienced ...
1
vote
3answers
1k views

When should one use “out” parameters?

In Objective-C, there are several methods like initWithContentsOfFile:encoding:error: where one passes in a reference to an NSError object for the error: parameter. In this example, the value of the ...
2
votes
3answers
88 views

Location of development solutions on disk - Common or upto the individual

In our team meeting today a senior member brought up the proposal that we should be having a common location/structure for our development solutions. A couple of his points were: Making it common ...
0
votes
2answers
118 views

Necessary Infrastructure for large project with many components communicating through IPCs

I have a fairly in depth question which probably doesn't have an exact answer. As a software engineer, I am usually tasked with working on a program or project with minimal understanding of how other ...
9
votes
9answers
1k views

Tips or techniques to use when you don't know how to code something? [closed]

I have a background as UI designer. And I realized that it is a bit hard for me to write a pieces of logic. Sometimes I get it right, but most of the time, I end up with something hacky (and it ...
6
votes
2answers
2k views

What are the benefits vs costs of comment annotation in PHP?

I have just started working with symfony2 and have run across comment annotations. Although comment annotation is not an inherent part of PHP, symfony2 adds support for this feature. My ...
5
votes
6answers
913 views

Is it bad to be the only person supporting software you have developed?

My employer has a need for a web-based application to manage and share data within the department, with approximately 50-75 possible users. I feel I have the ability to write it for them. I would ...
6
votes
2answers
11k views

Naming convention: field starting with “m” or “s”

I saw lot of code (for example some Android source code) where fields name start with a m while static fields start with s Example (taken from Android View class source): private SparseArray<...
10
votes
3answers
5k views

Child to Parent linking - bad idea?

I have a situation where my parent knows about it's child (duh) but I want the child to be able to reference the parent. The reason for this is that I want the child to have the ability to designate ...
5
votes
4answers
2k views

Learning by doing (and programming by trial and error) [closed]

How do you learn a new platform/toolkit while producing working code and keeping your codebase clean? When I know what I can do with the underlying platform and toolkit, I usually do this: I create ...
28
votes
12answers
3k views

Why should a class be anything other than “abstract” or “final/sealed”?

After 10+ years of java/c# programming, I find myself creating either: abstract classes: contract not meant to be instantiated as-is. final/sealed classes: implementation not meant to serve as base ...
8
votes
3answers
973 views

how to programtically build a grid of interlocking but random sized squares

I want to create a two dimensional layout of rectangular shapes, a grid made up of random sized cubes. The cubed should fit together and have equal padding or margin (space between). Kind of like a ...
8
votes
3answers
407 views

Is there such a concept as “pseudo implementation” in software development?

I'm looking for a label to describe the practice of using human-based computation methods or other means of "faking" an algorithm for the sake of getting a product or demo off the ground quickly ...
14
votes
2answers
948 views

Build one to throw away vs Second-system effect

On one hand there is an advice that says "Build one to throw away". Only after finishing a software system and seeing the end product we realize what went wrong in the design phase and understand how ...
1
vote
3answers
306 views

Programming C++ using Qt4 [closed]

Hey guys I am really new to the C++ programing I have a little knowledge in C and a bit more in C++, but I do not know them enough to call myself a programmer. I am working as a PHP Web Developer I ...
6
votes
2answers
270 views

What would be a non-contrived reason to have an object with Private Copy Constructor as well as Assignment Operator?

Looking for non-conceptual/non-contrived reasons of when one would need to use an object with both a private copy constructor and a private assignment operator? As in what problem does this technique/...
13
votes
2answers
2k views

What is the best approach for inline code comments?

We are doing some refactoring to a 20 years old legacy codebase, and I'm having a discussion with my colleague about the comments format in the code (plsql, java). There is no a default format for ...
11
votes
13answers
3k views

Dealing with curly brace soup

I've programmed in both C# and VB.NET for years, but primarily in VB. I'm making a career shift toward C# and, overall, I like C# better. One issue I'm having, though, is curly brace soup. In VB, ...
7
votes
3answers
546 views

Does studying other people's programs help in self growth? [closed]

Should I be studying big softwares written by other people in our company? My work may be a small sub module on the top of that software, and I may not be required to know what goes beneath the hood, ...
6
votes
3answers
2k views

Exception Handling Frequency/Log Detail

I am working on a fairly complex .NET application that interacts with another application. Many single-line statements are possible culprits for throwing an Exception and there is often nothing I can ...
8
votes
6answers
727 views

How to write good code with new stuff? [closed]

I always try to write easily readable code that is well structured. I face a particular problem when I am messing around with something new. I keep changing the code, structure and so many other ...
1
vote
6answers
2k views

Learning good OOP design and unlearning some bad habits [duplicate]

Possible Duplicate: What books or resources would you recommend to learn practical OO design and development concepts? I have been mostly a C programmer so far in my career with knowledge of C+...