Skip to main content

All Questions

39votes
8answers
10kviews

Is it ok copying code from one application to another, both belonging to the same repository, to keep them independent?

Given a repository which contains two different applications A and B (e.g. bootloader and RTOS), is it ok to copy source code from A to B in order to avoid dependencies (include's, adding A source ...
Martel's user avatar
1vote
2answers
155views

how best to take a vertical slice of something already trivial?

Lets say I have a project which is something relatively simple like a copy checker for legal text files stored in git, that multiple people contribute to via pull requests that must be reviewed before ...
A G's user avatar
  • 135
84votes
8answers
73kviews

Is modifying an incoming parameter an antipattern? [closed]

I am programming in Java, and I always make converters sort of like this: public OtherObject MyObject2OtherObject(MyObject mo){ ... Do the conversion return otherObject; } At the new ...
CsBalazsHungary's user avatar
2votes
4answers
3kviews

I wrote a class with "init" method. Should I call it from other class methods? Or leave it to the object user? (Code Design)

I have a java class with an init method. It's different from the constructor. The constructor just initializes the variables/fields. The init method connects to a database and performs some ...
joker's user avatar
29votes
9answers
8kviews

In software design, should an application remain agnostic regarding its usage with real world data / mock data?

Let me try to summarize a bit more with a simple example: You're building a large application, a user portal for example, with feeds, news, account management, and a whole range of difference ...
SikoSoft's user avatar
-1votes
1answer
100views

Is there any benefit/viability to sharing models across API versions that have differing schemas

I have been asked to get involved with a Team that is currently having delivery issues for various reasons. During my review I came across an acceptance criteria on a user story; If you call v1 of ...
Kinexus's user avatar
40votes
6answers
38kviews

Try/Catch/Log/Rethrow - Is Anti Pattern?

I can see several post where importance of handling exception at central location or at process boundary been emphasized as a good practice rather than littering every code block around try/catch. I ...
rahulaga-msft's user avatar
-1votes
3answers
872views

Would Injecting dependencies in C# as default parameters be a bad practice?

Given the (old) debate over whether Singletons are overused/abused/are worth it - would it be a bad idea to inject the dependencies as default parameters? In this way, we could get rid of defining ...
Veverke's user avatar
-1votes
1answer
107views

How can I prevent an object from being re-sanitized everytime it is passed as input to a function?

Suppose that I have a class named CharStream Additionally, there are a large number of functions which convert their function input into a CharStream def funky_the_function(_input): input = ...
Samuel Muldoon's user avatar
0votes
2answers
933views

Best pattern/practice to execute a multi-step code generation process

I am working on a project that generates an API with the possibility of doing CRUD operations based on a high-level description of the resources that the user would like to have in an application. In ...
jbolt's user avatar
8votes
5answers
983views

Is it bad practice to add "false or" or "true and" to conditionals?

Is it bad practice to add false or ... or true and ... for the sake of promoting code genericness and/or ease of use? As in: SELECT * FROM table WHERE TRUE AND IsEnabled AND SomeField = some_value ...
Nae's user avatar
  • 197
17votes
4answers
7kviews

Why does Facebook obfuscate the names of CSS classes?

If you look at the source code of a website such as Facebook, you'll see many classes as such: <div class="_cy6 _2s24"><div class="_4kny"><div class="uiToggle _8-a _1kj2 _4d1i _-57 _5-...
1234567's user avatar
43votes
6answers
14kviews

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 ...
Gary's user avatar
  • 533
1vote
1answer
822views

Is it bad practice to run different versions of code in different environments? (i.e. test, prod)

As an example, let's say you have the following pseudocode: if test environment: # meaning you don't have the typical service account prod perms sudo as service account + do operation else: # in ...
notacorn's user avatar
18votes
7answers
27kviews

Why unused variables is such an issue?

I was cleaning unused variables warnings one day, and I started to ponder, what exactly is the problem about them? In fact, some of them even help in debugging (e.g. inspect exception details, or ...
Tar's user avatar
  • 307

153050per page
close