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

2
votes
1answer
61 views

Best practice for unused inherited virtual functions (implementing superclass methods)

Let's assume I have a hierarchy of several classes each derived from each other using virtual functions. The base class acts as an interface and defines functions, which may not be required by all of ...
0
votes
1answer
41 views

Macro guard in Objective-C

I have noticed that many famous libraries written in Objective-C (eg. AFNetworking) use the macro guard inside their header files. Im aware that the #import directive, which works exactly like ...
0
votes
0answers
54 views

How to bring an application from Sublime Text to a web IDE for sharing? [closed]

I generally work on my projects locally in Sublime Text but sometimes need to share them with others using things like Jsfiddle, codepen, or plunker. This is usually so I can get unstuck. Is there an ...
1
vote
4answers
273 views

How can if (sscanf(buf, “%i”, &mode) != 1 || TRUE) be rewritten to if (TRUE)?

I got lost in the opening of this post on reddit. How can if (sscanf(buf, "%i", &mode) != 1 || TRUE) be rewritten to if (TRUE)? Does this assume that the sscanf never fails?
2
votes
1answer
104 views

Is there a pattern or best practice for passing a reference type to multiple classes vs a static class?

My .NET application creates HTML files, and as such, the structure looks like variable myData BuildHomePage() variable graph = new BuildGraphPage(myData) variable table = BuildTablePage(myData) ...
-1
votes
2answers
110 views

Data Access Objects old fashioned? [closed]

A couple of weeks ago I delivered some work for a university project. After a code review with some teachers I got some snarky remarks about the fact that I was (still) using Data Access Objects. The ...
-2
votes
1answer
53 views

Common phrases to know which resources are no longer available [closed]

I'm working on an script for tracking urls on a web page. This script runs daily to identify resources that are no longer available. If a page returns a status code like 404 I know the resource is ...
-5
votes
1answer
87 views

CAPTCHA blocking for my scraping script? [closed]

I am working on a scraping project which involves getting web data and parsing them for further use. I have been working using PHP and CURL to make scraping scripts which crawls web data and I make ...
0
votes
1answer
129 views

Best Practices For Temporary Scripts (Python)

I am running two separate programs which are similar enough that they share a lot of code. I run these programs often and after I evaluate the output. This is a very fluid process and everytime is ...
1
vote
0answers
52 views

MVC Controller - keeping methods small

I'm reading uncle Bob's Clean Code and it completely revolutionizes my programming style. In this book author claims that best methods are small methods. What about controller's action methods in ...
1
vote
2answers
316 views

How to approach program design with respect to data strucutres and algorimths - is there an equivelant of the OO design process for d.s.'s + algs? [closed]

My applogies for probably the worst written body of text I have produced in my life and many thanks to those willing to plough through it all. I was (and still am) not able to clearly express what I ...
0
votes
3answers
199 views

Is it a newbie mistake to avoid branching? [duplicate]

My team is new to versioning and we're trying to keep things simple, as to not overwhelm ourselves with tools-headaches. Also, our product can't be compiled and run locally, so our work is actually ...
0
votes
1answer
82 views

Python case statement? [duplicate]

I made a simple Python script that takes user input in order to generate a series of mathematical responses. In one part I did this: while True: And iterated through the loop until I used an if ...
-2
votes
1answer
137 views

Explain what this means, “Bulldozer Code” [closed]

I ran across an article on things programmers should avoid doing and came across this term: Bulldozer Code. The author defined it at as "giving the appearance of refactoring by breaking out chunks ...
0
votes
4answers
63 views

Proper sequence of actions for merging using SVN?

I'm totally new to CVCS (SVN specifically). I find that most resources focus very strongly on the command-line commands (irrelevant; we use Windows Explorer + TortoiseSVN) and about structure (e.g. ...
1
vote
1answer
118 views

Develop in trunk and then branch off, or in release branch and then merge back? [duplicate]

Say that we've decided on following a "release-based" branching strategy, so we'll have a branch for each release, and we can add maintenance updates as sub-branches from those. Does it matter ...
-2
votes
2answers
157 views

What to do with a long unfinished project? [closed]

I am a programmer hobbyist (self learnt), and once in a while I like to make games and interactive scripts (nowadays mostly in JavaScript for its ease). Sometimes I start long projects that end up ...
19
votes
6answers
1k views

Should I place functions that are only used in one other function, within that function?

Specifically, I'm writing in JavaScript. Let's say my primary function is Function A. If Function A makes several calls to Function B, but Function B is not used anywhere else, then should I just ...
1
vote
5answers
92 views

Many Arguments in Case Classes [closed]

I have generally read that having many (>4) arguments to a function/constructor is a bad practice. Is this still considered a bad practice? And is there a non-obvious reason? In something like a ...
-1
votes
0answers
53 views

What approaches work with old undocumented code? [duplicate]

Recently I became responsible for a small system in Java. This program, which through the web interface gives all the information on our corporate database. With this system almost continuously ...
0
votes
2answers
109 views

Alternatives to the use of the Id/Name properties with non-inputs elements in HTML

I'm migrating a website that use Javacsript/HTML/PHP using reusable javascript code, in certain moment I saw the opportunity to simplify code in functions that use almost the same code. Let's say: I ...
1
vote
1answer
161 views

OnClickListener good practice

Which one of the ways has better performance, or is a good programming practice, making the holder activity extend OnClickListener and make a Switch() clause for getItemId() or making one ...
5
votes
4answers
2k views

Should you ever use private on fields and methods in C#?

I am somewhat new to C# and just found out that: in C# all of the fields and methods in a class are default private. Meaning that this: class MyClass { string myString } is the same as: class ...
4
votes
2answers
1k views

When is it appropriate to do calculations in front-end?

My team is developing a WEB based finance application and there was a bit of an argument with a colleague where to keep the calculations - purely in back-end or keep some in front-end too? Brief ...
-2
votes
0answers
28 views

How to merge my code with other existing code? [duplicate]

i make some improvements to my friend´s code, now i need to add my code to someone else´s code that hasn´t any documentation nor test functions. How to merge my code with my team´s code without ...
40
votes
6answers
3k views

Is making a small change, testing it, then “rinse and repeat”, a bad habit?

I am a programmer with a number of years of experience. I realized I got a certain habit. I'm not sure whether it's really a bad habit or not. I get a list of tasks to perform for a solution, even ...
3
votes
1answer
167 views

Java-Like 'throws'-information in method signature C#

From Java I know that the signatures of methods that can throw exceptions contain a throws block, that contains the Exception(s) that might be thrown. In C# there is no such thing and it is also not ...
0
votes
1answer
69 views

Should data be stored to local database in Android when heavily using REST services?

Let's say I have an application that has constantly changing data. Changes are so frequent that you basically need to refresh data every time you open some screen and keep refreshing it. Is it worth ...
1
vote
2answers
93 views

Unit testing - should tests for a method validate the results of other methods?

One thing bothers me while I'm writing unit tests of my code. did tests of method should include validation of outcome from other methods? Of course, public methods. Let's go to - rather trivial - ...
5
votes
1answer
134 views

How to avoid reinventing the wheel when using complex frameworks?

For the backstory, I'm developing a GUI application in C#/WPF. I already had in my code quite many instances of <ComboBox ItemsSource="{Binding Items}"> <ComboBox.ItemTemplate> ...
0
votes
2answers
354 views

Is it necessary to memorize every line of code when it comes to game development? [closed]

I am currently following along a youtube tutorial here and from what I understand we are starting out by creating an engine to run the game. Should I be able to implement all of this by myself without ...
0
votes
1answer
98 views

Best practices in designing a social network app? [closed]

What are best practices when it comes to designing a social network app for Android (possible iOS port later depending on uptake)? It's my first time architecting something this scale from scratch, ...
1
vote
0answers
60 views

Preferred method for handling Failed CRUD operations in Entity Framework (6)?

I am using EF 6 as my ORM. I am trying to decide how to handle CRUD failures. Option 1: Use exceptions (custom or built-in) to inform the web layer that an item didn't correctly save. Handle the ...
1
vote
2answers
65 views

Creating menu structure using DB - is that fine?

Also I have an application that basically consists of a lot of screen so user needs to navigate a lot (like go from A>B>C>D) etc. I have been thinking how to implement this (mainly hold the structure ...
5
votes
2answers
205 views

How to handle a vendor who asks for the solution of an issue they could not solve

Being a small department of developers, it's not uncommon for us to outsource projects. We have a set of companies that we really like to work with, very reliable and good local people who appreciate ...
0
votes
2answers
82 views

Why are some files in programming projects named “commons”?

I have seen numerous projects have a file named commons for example: commomns.go I was wondering, why was this convention adopted and what did the meaning of naming a file or a package or something ...
8
votes
1answer
597 views

I know JavaScript really well, but i bomb coding interviews [closed]

So I'm currently on a hunt for a new position as a Front-End Developer. I know JavaScript very well and can wax poetically about Closures, Currying, Prototypal Inheritance, Design Patterns, App ...
-1
votes
2answers
210 views

Whats the best way to build a HTML/AJAX site that requires login? [closed]

Let's say that hypothetically you wanted to build a website that delivered content to the visitors entirely using HTML and Javascript (AJAX to fetch server side data). The site would require login for ...
3
votes
2answers
307 views

Why to declare a String (as final) and then use it?

In a typical spring mvc validator class, while inserting an errorCode value in the Errors object, what difference does it make between using a String (props.somefield.req) like so ...
1
vote
2answers
73 views

Daily builds with SVN for a small team

I have a general question regarding best practices. I have a small team working on a medium-scale software project, which involves integrating code from different environments, etc. The project is a ...
0
votes
2answers
251 views

Preventing ip resolvers in a skype-like program

I'm currently in the process of creating a Skype-like program, that uses a hybrid peer to peer system to communicate between users (i.e. server contains all users IPs, a client that wants to connect ...
2
votes
2answers
86 views

How to prove that following practices and industrial standards are profitable, and investment in refactoring are good

I started working in a company not much time ago, and what I see a lot inside a project is a high amount of low quality code and some custom ideas instead of industry standards and selected best ...
2
votes
2answers
211 views

What happens if I close an InputStream that is passed as an argument?

I have read that Java is pass-by-value, and I've been reading about it in this question at StackOverflow, but I'm still a bit confused, regarding the close() or shutdown() methods in various classes. ...
3
votes
3answers
398 views

Refactoring previous intern's noodle code with future interns in mind [duplicate]

Background I've run across this problem as I am currently an intern at a large company's local software division. I have been given the task of extending a project that several previous interns have ...
1
vote
1answer
159 views

Are the over-usage of delegates a bad thing?

Good day. I have been told that a good practice for writing methods is to make the method only responsible for doing one thing. It made sense to me now that I look back upon it in retrospect. There ...
-1
votes
3answers
173 views

Programming with emacs instead of a debugger-integrated IDE [closed]

There's a question that might be deemed a duplicate of this one (I use an IDE (Eclipse) to develop software. Why should I switch to vim or emacs?) but I don't think answers my question. I usually ...
1
vote
2answers
137 views

Pros and cons for choosing between different return types

This is in context of a client-server architecture, although I don't think the architectural setting is needed to put up the problem. I have a function whose output can be classified into different ...
185
votes
16answers
13k views

Started wrong with a project. Should I start over?

I'm a beginner web developer (one year of experience). A couple of weeks after graduating, I got offered a job to build a web application for a company whose owner is not much of a tech guy. He ...
0
votes
2answers
56 views

Automatically propagating changes

When working on multiple similar projects there are often changes that can't be extracted into a library, but should be applied to most of the projects. I mean changes like a modified directory ...
1
vote
3answers
270 views

Trying to come up with a mapping convention for C# objects

so this is C# but it could apply to any OO language where different sets of objects exist across different layers of an application. We have been trying to come up with a convention within the team ...