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

4
votes
3answers
170 views

Is it more advantageous to write a program to test your code (ie a client) or just use the main portion of your program?

For instance if I had a program with a bunch of methods. public class Dog{ public boolean ishappy{..} public int weight{...} public static void main{ ...
7
votes
6answers
980 views

How to recover from finite-state-machine breakdown?

My question may seems very scientific but I think it's a common problem and seasoned developers and programmers hopefully will have some advice to avoid the problem I mention in title. Btw., what I ...
6
votes
4answers
704 views

Should injecting dependencies be done in the ctor or per method?

Consider: public class CtorInjectionExample { public CtorInjectionExample(ISomeRepository SomeRepositoryIn, IOtherRepository OtherRepositoryIn) { this._someRepository = ...
5
votes
6answers
1k views

Why is C++ backward compatibility important / necessary? [closed]

As far as I understand it is a wide-spread opinion within the C++ community that certain features of C++ (including some features inherited directly from C), while still usable in themselves, do not ...
5
votes
2answers
162 views

What are approaches for analyzing the cost-benefits of a development methodology?

There are many development practices (TDD, continuous integration, cowboy-coding), principles (SOLID, layers of abstraction, KISS), and processes (RUP, Scrum, XP, Waterfall). I have learned you can't ...
13
votes
9answers
1k views

Does your programming knowledge decrease if you don't practice? [closed]

I'm a novice programmer. I study languages such as C, C++, Python and Java (mainly focusing on C++). I'm what you'd call "young and inexperienced" and I admit that because I can't claim otherwise. ...
4
votes
3answers
2k views

URL Encryption vs. Encoding

At the moment non/semi sensitive information is sent from one page to another via GET on our web application. Such as user ID or page number requested etc. Sometimes slightly more sensitive ...
3
votes
3answers
186 views

To reorganize code, what to choose between library and service?

I want to reorganize a large application with lot of code duplication into multiple components. Plus, some code is also duplicated over other applications. The common set of functionality that can be ...
20
votes
7answers
2k views

while(true) and loop-breaking - anti-pattern?

Consider the following code: public void doSomething(int input) { while(true) { TransformInSomeWay(input); if(ProcessingComplete(input)) break; ...
55
votes
17answers
4k views

How to deal with tautology in comments?

Sometimes I find myself in situations when the part of code that I am writing is (or seems to be) so self-evident that its name would be basically repeated as a comment: class Example { /// ...
21
votes
11answers
2k views

Should I be concerned that I can't program very fast without Google? [duplicate]

Possible Duplicate: Google is good or bad for programmer? I'm currently in college to be a software engineer, and one of the main principles taught to us is how to learn for ourselves, and ...
7
votes
3answers
2k views

Should main method be only consists of object creations and method calls?

A friend of mine told me that, the best practice is class containing main method should be named Main and only contains main method. Also main method should only parse inputs, create other objects and ...
11
votes
9answers
5k views

if/else statements or exceptions [duplicate]

Possible Duplicate: Defensive Programming vs Exception Handling? I don't know, that this question fit better on this site, or Stack Overflow, but because my question is connected rather to ...
2
votes
2answers
104 views

User input and automated input separation

I have a MySQL database and an automation script which modifies the data inside once a day. And these columns may have changed by an user manually. What is the best approach to make the system only ...
0
votes
5answers
884 views

Do I have to write a lot of boilerplate code if I keep working using Java? [closed]

I'm working for a company writing ERP applications. My problem is that I have to write tons of boilerplate code. I came up with ideas to automatize/prevent the drudgery but only some of them were ...
135
votes
22answers
13k views

How would you know if you've written readable and easily maintainable code?

How would one know if the code he has created is easily maintainable and readable? Of course in your point of view (the one who actually wrote the code) your code is readable and maintainable, but we ...
2
votes
1answer
125 views

A job role where connection with other developers along with writing code

Is there a position in companies (and which ones?) where the role is writing some code along with going on to the seminars to connect with other developers who maybe the clients of your/company's ...
1
vote
2answers
549 views

Is it better to build HTML Code string on the server or on the client side?

The result of the following process should be a html form. This form's structure varies from one to user. For example there might be a different number of rows or there may be the need for rowspan and ...
1
vote
1answer
2k views

How frequent should the Token Updation in CSRF security be?

To start with the background, this post is what Jeff Atwood says about CSRF tokens. In this very page, he goes on to say: An even stronger, albeit more complex, prevention method is to leverage ...
2
votes
3answers
159 views

Alternate approaches to creating custom forms in a web application

We are putting together some distribution software, selling about 150K SKU's. Some of our items have additional requirements in order to be sold that are dictated by our vendors. For instance one type ...
3
votes
3answers
489 views

Agile development : How to design your code for an iteration / Sprint?

In Agile development you work on small user stories and produce a working iteration. But what happens when the next user story comes in and affects the design for the already done iteration? ...
3
votes
4answers
4k views

What is best practice for log level in PHP?

When programming in C, I often get the advice to turn on many or all warnings and not ignore warnings. Does the same hold in PHP, should I enable all warnings in the PHP log?
2
votes
6answers
7k views

How to learn Math to increase Programming skills? [duplicate]

Possible Duplicate: What degree of mathematical knowledge should a programmer have? Where should I start learning math with regards to programming I need an advice. Im a web developer ...
8
votes
14answers
2k views

How to minimize typos when you code?

I make a lot of typing mistakes when I program. I have a good keyboard writing speed but I try to write faster and in the process end up making typos. I want to type faster, but make less errors. Can ...
6
votes
5answers
2k views

Is it a bad practice to use GUI designer tools with code generation for application programming in Java/C++?

In a stackOverflow question I have read that using a GUI designer program can generate lots of messy code and is considered to be a bad practice unless you're making smaller programs. My question is ...
5
votes
5answers
3k views

How important is it to pick the best IDE for your programming language of choice?

As I learned some basic programming languages I came across tens of IDEs, and tens of compilers. Most people you ask will tell you "Go with that IDE or go with the best" etc, however they do not ...
8
votes
3answers
313 views

Is there a drawback in defining multiple small DRY classes, instead of bigger more repetitive classes? [duplicate]

I read some articles and it seems that using multiple classes in CSS is encouraged. I am curious to find out if there is a maximum number of classes an element can have before this multiple class ...
6
votes
2answers
310 views

Is there a certain number of lines of code to be followed /maintain?

I am developing a software system (Patient Administration System) and I have noticed it already had 451 lines of code(in one namespace). Is this bad? Or does the number of lines of code not matter ...
2
votes
2answers
223 views

Methods of ordering function definitions in code

When I work on some programming project (usually command line application in Python with many switches), I'm usually creating about 30 and more functions. Most of the functions are in one file (except ...
4
votes
3answers
1k views

Should a method do one thing and be good at it? [duplicate]

"Extract Till You Drop" is someting I've read in Uncle Bob's blog, meaning that a method should do one thing alone be good at it. What is that one thing? When should you stop extracting methods? ...
0
votes
4answers
540 views

How does using #define for loop and condition bounds in C increase security?

My program uses the following define statements: #define LOWEST_PATIENT_ID 10000 #define HIGHEST_PATIENT_ID 99999 #define LOWEST_CRITICAL_STATUS 1 #define HIGHEST_CRITICAL_STATUS 100 used in this ...
3
votes
5answers
577 views

What is considered best practice for printing usage / help (--help)?

When writing tools for the CLI of UNIX, how should I make the program print out help and/or usage? I usually use fprintf(stderr, "help text here");, but there are several issues with that. First, ...
10
votes
3answers
502 views

Programming *into* a language vs. writing C code in Ruby

Code Complete states that you should aways code into a language as opposed to code in it. By that, they mean Don't limit your programming thinking only to the concepts that are supported ...
9
votes
7answers
1k views

Checking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional?

Is it a good practice to call a method that returns true or false values in an if statement? Something like this: private void VerifyAccount() { if (!ValidateCredentials(txtUser.Text, ...
74
votes
12answers
6k 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 ...
27
votes
17answers
3k views

Is it a good practice to name the returned variable “result”? [closed]

Is it a good practice to call the variable a method returns with a variable name result? For instance: public Zorglub calculate() { Zorglub result = [...] [...] return result; } Or ...
123
votes
22answers
14k views

Why are shortcuts like x += y considered good practice?

I have no idea what these are actually called, but I see them all the time. The Python implementation is something like: x += 5 as a shorthand notation for x = x + 5. But why is this considered good ...
35
votes
14answers
7k views

Is programming or computer science in general, all about algorithms?

As a grad student, I find it more and more common for prestigious companies (like Google, Facebook, Microsoft,...) to put algorithm questions in their test and interviews. A few startups I applied to ...
27
votes
8answers
12k views

Private variable vs property?

When setting a value to a variable inside of a class most of the time we are presented with two options: private string myValue; public string MyValue { get { return myValue; } set { myValue = ...
21
votes
11answers
7k views

typedefs and #defines

We all have definitely used typedefs and #defines one time or the other. Today while working with them, I started pondering on a thing. Consider the below 2 situations to use int data type with ...
1
vote
5answers
157 views

Automatic sorting of class/module members and its possible impact on productivity and code quality

Recently I saw some possibilities of some IDEs (via plugins) to sort members of their classes/modules based on some criteria, sou you could have everything sorted automaticaly no matter where you ...
2
votes
3answers
548 views

Is it important/essential to learn software development methodologies for beginners?

I'm a student and I've been programming for not very long. Particularly, I'm learning CodeIgniter framework - The book I'm reading is "Professional CodeIgniter". In the book, the author mentioned ...
8
votes
7answers
713 views

As a programmer, what am I supposed to know like the back of my hand? [closed]

I am talking of stuff related to programming only and not system or network administration. I am about to finish college and get a programming job, so I am interested to know about this. Although ...
7
votes
5answers
9k views

How to handle large numbers?

Well, I've just started doing puzzles and it's so annoying to see puzzles which are easy to do but also need to handle very large numbers. That's the problem. Say I have to deal with numbers like 10 ...
2
votes
6answers
589 views

How to make code writing more accurate? [duplicate]

I am trying to practice writing code for a long period of time before compiling and write unit test (if possible) for what I wrote (the language is C++). Of course, I got the IDE support (Emacs or ...
-2
votes
1answer
2k views

Why is BASIC bad? [duplicate]

Possible Duplicate: Do you think that exposure to BASIC can mutilate your mind? BASIC, and related dialects, have long been branded "bad". I've seen it said by some of the best programmers ...
20
votes
10answers
2k views

Struggling as a programmer. Need some advice [closed]

I've been a developer now for a number of years. I'm pretty good at what I do and can "get the job done". But, there is a difference between "getting the job done" and "doing the job properly". Let's ...
56
votes
5answers
36k views

Two HTML elements with same id attribute: How bad is it really?

Just browsing the google maps source code. In their header, they have 2 divs with id="search" one contains the other, and also has jstrack="1" attribute. There is a form separating them like so: ...
34
votes
7answers
2k views

How to convert a copy/paste/spaghetti programmer to see the light?

This question was inspired by this one. While that other question was deemed localized, I believe the underlying problem is something that is extremely common in our industry. I know there are some ...
9
votes
2answers
724 views

What does a “bodyshop” (in context of a programming job /environment) mean

I've kept on coming across the term "bodyshop" in terms of a programming job/environment but despite googling I can't find out what exactly this is referring to? Can someone please enlighten me?