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

-3
votes
0answers
14 views

Android zxing integration

Sorry if this is the wrong place to post, I'm new to stack exchange. I am trying to use zxing's core.java, to read qr codes from the camera, not using the intent that calls a zxing app. I have found ...
-2
votes
0answers
207 views

I have a Computer Science degree but I don't feel like I know how to program [on hold]

Well I went through university to obtain my Bachelors in computer science but I don't feel confident at all in programming. I know, I know, practice. Well I am practicing but I feel that it will be ...
1
vote
2answers
85 views

C# Subject Observer Architecture question

I'm making a C# application using the Subject Observer design pattern in a slightly different way. I am passing the Provider Class, implementing IObservable (this has the OnNext() method that ...
0
votes
0answers
12 views

Which view resolver is required for implementing tiles in Spring 3.0 MVC application [migrated]

I have a working Spring application. I would like to add some common headers,footers and such, hence I need to use tiles along with this. Currently, I use InternalResourceViewResolver for request ...
-1
votes
0answers
46 views

Where can I find an easy summary of best Python programming practises? [on hold]

Where can I find a compact summary of best Python Practises, preferably in poster format or a few pages long? Giving my project group a website is in my eyes not too effective, since I'd like to have ...
-3
votes
0answers
55 views

Creating a simple Window program [on hold]

so I am new to programming I am using mainly the console do program.And since I am a beginner I was wondering how can I make a simple window program with Text?I am sorry for my newbie question but I ...
-2
votes
1answer
50 views

Any error will ocurr in this statement? ((a)*(b)) [on hold]

#define Product (a,b) ((a)*(b)) I assume "a" and "b" is an integer or a real number. Here are the errors I could think off If the programmer for some reason and apply string or ...
3
votes
3answers
126 views

Development Time: sql in UI code vs domain model with datamapper

First, sorry for my English guys. Currently this is my first programming job. I am labeled as the most incompetent programmer in my company that's because they measure the performance and ...
0
votes
0answers
12 views

Looking to increase the speed of my bash script [migrated]

The title pretty much says it all, I have a short bash script that processes gigs and gigs of data. I am looking for any improvements to make it faster. This is my very first bash script so please ...
6
votes
5answers
787 views

What is the effectiveness of code reviewing by just reading? [duplicate]

I have been given the task of reviewing a change request comprising of more than 20 changes, the problem is that we do not / cannot install a version of the software to be evaluated as the development ...
2
votes
3answers
155 views

Documenting intent Vs knowledge

It is said you should document the intent of your function or class which I agree with. However recently this line became a little bit blurred when I was wanting someone to document why this ...
3
votes
3answers
105 views

How to write tests for function that depends on a config file?

I have a function that uses information from a config file. How do I test the function? Ideally, I'd want to inject my own version of the config file and test from there, but I'm not using dependency ...
0
votes
1answer
44 views

Is it OK to use name like `CLASS_CONSTANT` for class constant variables according to PEPs? [python]

On the code I'm viewing, I saw a class like this: class User(ModelBase): """# User: docstring""" COMBAT_RANK_KEY_PREFIX = 'combat_rank' LEVEL_RANK_KEY_PREFIX = 'level_rank' ...
4
votes
1answer
856 views

Should I avoid using style like `for k, v in dict_sample.items()`?

Today I was viewing my colleague's code and I saw a function like this: def manager_skill_tree_func(*args, **kwargs): """# manage_skill_tree: Initialize the manage skill tree """ ...
0
votes
2answers
49 views

Should I use Core Data for a social networking app with multiple “feeds”? [on hold]

I have a social network that needs an iOS app built, but I'm struggling to decide whether or not I need (or just if it would help) to use Core Data. The premise will be very similar to Facebook, ...
2
votes
3answers
73 views

Data padding for different hardware support?

Some hardware cannot read non-aligned data. For example Bitmap images are aligned to 4-bytes from the header and with each scan line in order to maintain device independence. For example you can ...
1
vote
3answers
280 views

Use interface or abstract class?

Now the title might seem like the question has been asked before but let me explain my situation and you'll see why I am asking this question. Let's consider this interface : public interface ...
5
votes
1answer
102 views

Compute Adjacent Pair

I was asked the following question as part of an interview: Integer V lies strictly between integers U and W if U < V < W or if U > V > W. A non-empty zero-indexed array A consisting of ...
9
votes
3answers
945 views

How did desktop applications communicate with remote server before webservices?

I don't have lot of expierence with desktop applications, but if I had to create a client server desktop app, the data access would be done through a webservice. I believe data access through a ...
35
votes
9answers
12k views

Why do schools teach arrays over List? [closed]

Most of the assignments in my school for the initial programming classes required me to use arrays. I work full time now, and I never used an array for any project that I have worked on. Even in the ...
-1
votes
1answer
60 views

What is the easiest way to store a piece of text in an HTML page? [closed]

I'll say in advance - I have almost no experience with HTML. I am currently coding a game in Lua, which needs to access a piece of code from an HTML website using GET. My question is this: What is ...
1
vote
0answers
75 views

Single page application automatically download dependent HTML

I'm currently developing an application using ASP.NET MVC5 and Knockout. For now, the typical architecture is this: FooController.cs: public ActionResult GetFoos(){ //... var model = // ...
1
vote
2answers
123 views

Is setting “permanent” persistent login cookies a bad practice?

I realized that in Rails there is a built in permanent method for its persistent login cookies (aka. "remember me" cookies) method to give the client a cookie that expires in 20 years: ...
2
votes
3answers
424 views

Can a Java Boolean be used for ternary (3-state) logic?

I'm trying to make a basic cache of a boolean value, and I did it like such: private Boolean _valueCache = null; private boolean getValue() { try { if (_valueCache == null) { // if cache ...
-2
votes
0answers
62 views

How to deal with utilities with same name but behave differently between Unix and Linux? [migrated]

For some reason, I chose Macbook as my computer to managing remote Linux servers. Sometimes I will encounter troubles with those utilities which have the same name but behave differently between ...
1
vote
1answer
328 views

What programming technique is this?

I have two Java classes. The first one is called "Index", and the second one, temporarily, I called it "IndexCache": public class IndexCache { private static Map<String, Index> map = null; ...
3
votes
1answer
232 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++ programmation (specifically with the Qt Framework) I only use the old raw pointer : SomeKindOfObject *someKindOfObject = ...
1
vote
1answer
109 views

How to work with a messy codebase and client [duplicate]

A client came to me with some features he wanted implementing. Easy enough to do what he asked. He paid me, I agreed to start on the start date and finish in 3 weeks. The code base is a disaster. It ...
1
vote
1answer
189 views

How to avoid violating one definition rule in this case?

We have an existing Mutex C++ class. It has a debug feature to track the owner thread id. So it has a member variable to store this, but because the original developer doesn't want to waste memory, ...
0
votes
2answers
99 views

Create the fields in class level then instantiate inside methods or create and instantiated inside methods

I'm a newbie in software development. Just wondering which code is better and why should I continue which pattern should I follow. First Snippet: Class TestClass { private Object1 field = null; ...
2
votes
2answers
86 views

Free Standing Functions in Global Namespace

When writing non-member, free functions, can they be placed in the global namespace so long as the signature specifies a namespace-scoped object? For example, in the code below, is "Example 2" ...
0
votes
2answers
78 views

Best way to offer team member help? [duplicate]

I've been having a problem recently. In my recent sprints, I have found myself finishing my work well before the sprint ends (several hours in a 2 week sprint). I am left with a lot of time and ...
1
vote
2answers
139 views

Is relying on Demorgan's law in open-source code a barrier to contribution?

I recently added this code to a Github project I'm working on: if not initial_push=='y' and not initial_push=='yes': print('Aborting.') return False Since this is a public ...
1
vote
2answers
93 views

How is a dictionary better than a big switch, when mapping data to action? [duplicate]

Often times we see stuff like that in code: void myFunction(string someValue) { if (someValue == "a") { // ... } else if (someValue == "b") { // ... } else if (someValue == ...
0
votes
5answers
159 views

Is it bad form to use the same variable name in different scopes?

Say you have some basic code where similar operations will take place in nearby lexical scopes. Take for example some simple pseudo code: variable = "foo" # Do something with variable if (True) { ...
0
votes
1answer
117 views

Why use the Singleton pattern over class functions and fields? [duplicate]

I'm going to start by saying that I understand that programming in mostly class functions and variables can be harmful to object-orientation, and that most of the time an instance is preferred. I'll ...
-1
votes
2answers
125 views

Should I learn a programming language that compiles to another? [closed]

For about a year now, I've been doing full stack web development. I am doing about 66% backend stuff (in Python), but from a time to time, I need to write HTML, CSS and JavaScript. I really want to ...
1
vote
2answers
540 views

How can i get around of infinite circle of technology change [duplicate]

I have been in web developement for 6 years. I am facing one big problem and i want to know how can i get rid of it. There are many personal projects like web application which i want o build. As an ...
0
votes
1answer
192 views

Is it good practice to shorten functions? [duplicate]

Is it good practice to shorten functions? Like this code for instance: using System; namespace Hello { class Program { public static void ...
28
votes
8answers
4k views

Is throwing an exception an anti-pattern here?

I just had a discussion over a design choice after a code review. I wonder what your opinions are. There's this Preferences class, which is a bucket for key-value pairs. Null values are legal ...
1
vote
1answer
82 views

Best practices for lookup tables in the application - by id or value

I have a complex database application. There are a lot of lookup tables containing a few values, in particular one contains pass / fail / waiting / unknown. In the application I find many of the ...
3
votes
5answers
154 views

Exception handling and 3rd party library

I'm currently having an issue with a 3rd party control library provider. They have an exception occulting culture that gets in the way of my general fail-fast approach when developing software. An ...
8
votes
8answers
3k views

Are there any easy-to-follow/reliable methods for simplifying code? [duplicate]

There is a problem with the way I code. Regardless of how much of a plan I write beforehand, the code becomes overcomplicated quickly. Reading books on good practice and attempting to adhere to their ...
2
votes
5answers
550 views

When, if ever, should I daisy chain functions?

I'll try to be as brief as possible in respect to your time. In a program divided up into many functions by which it is intended that they execute themselves one after another, when (if ever) is it ...
0
votes
1answer
75 views

How can I condense a case class with ~20 constructor arguments into 5 or 6 arguments in Scala?

Let's say I have a case class with ~20 constructor arguments? This is obviously very clunky to type. What would be the best way to condense these arguments into maybe 5 or 6 arguments? There are some ...
0
votes
2answers
71 views

What does one mean by UI Independent client logic?

I was reading this excellent post on Gmail's Blog. And I came across this line in the end which says, If you’re building an application that (a) has significant UI independent client logic ...
3
votes
2answers
189 views

Software development - The industry & general trends / Bad practices [duplicate]

I am a Web Developer and part of a small team working on an abundance of projects. This is my first "actual" real company after graduating with a degree in computer Science and I have about 2 years ...
0
votes
2answers
71 views

How do I organizing 2 different projects with shared code

I know there have been same question asked multiple times on the programmers stackexchange. I think my question is more specific and hence decided to start a new question. My current a project which ...
10
votes
3answers
1k views

Are there any benefits of using this extra variable in the for loop annotation?

I have found the following loop annotation in a big project I am working on (pseudocode): var someOtherArray = []; for (var i = 0, n = array.length; i < n; i++) { someOtherArray[i] = ...
0
votes
1answer
98 views

Is it reliable to use and download libraries needed from GitHub and copy-pasting codes in order to increase productivity? [duplicate]

I'm just wondering. Is it okay or true that some of the best programmers once taught that to become an effective programmer is through being a lazy programmer rather than spend time memorizing lots of ...