Click here to Skip to main content
15,888,461 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
QuestionNever use pure built in types Pin
D4rkTrick11-Dec-14 6:23
professionalD4rkTrick11-Dec-14 6:23 
AnswerRe: Never use pure built in types Pin
Richard MacCutchan11-Dec-14 6:43
mveRichard MacCutchan11-Dec-14 6:43 
GeneralRe: Never use pure built in types Pin
D4rkTrick21-Dec-14 8:18
professionalD4rkTrick21-Dec-14 8:18 
AnswerRe: Never use pure built in types Pin
den2k8811-Dec-14 7:37
professionalden2k8811-Dec-14 7:37 
GeneralRe: Never use pure built in types Pin
jschell12-Dec-14 12:29
jschell12-Dec-14 12:29 
GeneralRe: Never use pure built in types Pin
den2k8814-Dec-14 0:09
professionalden2k8814-Dec-14 0:09 
GeneralRe: Never use pure built in types Pin
jschell16-Dec-14 12:37
jschell16-Dec-14 12:37 
AnswerRe: Never use pure built in types Pin
jschell12-Dec-14 12:26
jschell12-Dec-14 12:26 
Ricky Rick wrote:
* having full control over what type the variable really represents.

scenarios:

- an ID is a *number* at first and changes to have letters in it later

- the System (connected with a database) was not designed for having so many users and now we're running out of IDs (getting closer to max-integer)


Nope. Certainly can use "int ID" in a million lines of code and then expect to do nothing if you change it to "string ID".

Ricky Rick wrote:
* throughout all code it's rather easy to see which variables represent the same functional meaning.


Throughout all of the code the data probably will not have the same meaning. For example as a database designer I might need to store a time stamp in a database using two columns (seconds and nanos), the business logic uses a timestamp (single value) and the UI uses a formatted text value localized for the user.

Ricky Rick wrote:
* range-changes can be made rather easy: just change the typedef


Normal sequential numerics in a database do not extend for the full binary range of something like an integer. Only positive values need apply.

And I do NOT want to find out I have run out of ids in the database when the entire application fails because the id is too big. So I need a range check before that. And although a medical database might allow a birthday of Jan 1 1901, it shouldn't allow one for Jan 1 1001.

Ricky Rick wrote:
* avoid uncareful castings(anti-temptating): it's easy to cast a "integer" to an "unsigned integer". But it's rather hard to cast a "second" to a "user-id", even if both is an "integer" behind the scenes.


Been a few years since I worked in C++ but rather positive than I can do exactly that. Matter of fact it is easier to do it that way than the right way. And assignment still works so why would anyone be attempting to cast (per your example)?

Ricky Rick wrote:
On the cons-side of course, we have a massive overhead (at first)


Presumably you mean managing the types rather than anything to do with performance.

The real problem here is that you are going to end up with a non-trivial number of types that exist for one instance.

Ricky Rick wrote:
what do you think about that?


Code to what you know and not all possibilities.
It makes it easier for you and makes it vastly easier for someone else that needs to maintain your code after you are gone.

So, for example, if you did in fact have a type of value that was used in many places and which you knew (based on existing or future requirements) that would need to change then putting an actual type, like a class, in place would be a good idea.

Otherwise don't.
GeneralRe: Never use pure built in types Pin
D4rkTrick21-Dec-14 8:17
professionalD4rkTrick21-Dec-14 8:17 
QuestionHow to avoid backend stored procedures Pin
nstk8-Dec-14 21:24
nstk8-Dec-14 21:24 
JokeRe: How to avoid backend stored procedures Pin
Brady Kelly12-Dec-14 5:52
Brady Kelly12-Dec-14 5:52 
AnswerRe: How to avoid backend stored procedures Pin
Eddy Vluggen12-Dec-14 7:27
professionalEddy Vluggen12-Dec-14 7:27 
AnswerRe: How to avoid backend stored procedures Pin
Dominic Burford23-Dec-14 1:35
professionalDominic Burford23-Dec-14 1:35 
QuestionRearchitecting BackgroundWorker based to Task based? Pin
Matt T Heffron17-Nov-14 12:49
professionalMatt T Heffron17-Nov-14 12:49 
AnswerRe: Rearchitecting BackgroundWorker based to Task based? Pin
Richard Deeming18-Nov-14 2:45
mveRichard Deeming18-Nov-14 2:45 
AnswerRe: Rearchitecting BackgroundWorker based to Task based? Pin
Gerry Schmitz18-Nov-14 7:00
mveGerry Schmitz18-Nov-14 7:00 
QuestionRemote Desktop Connection Pin
Non Sequitur11-Nov-14 3:43
Non Sequitur11-Nov-14 3:43 
SuggestionRe: Remote Desktop Connection Pin
ZurdoDev11-Nov-14 5:27
professionalZurdoDev11-Nov-14 5:27 
AnswerRe: Remote Desktop Connection Pin
Pete O'Hanlon11-Nov-14 5:57
mvePete O'Hanlon11-Nov-14 5:57 
QuestionWhat is an architect for? Pin
Member 448708318-Oct-14 10:19
Member 448708318-Oct-14 10:19 
JokeRe: What is an architect for? Pin
Vivi Chellappa18-Oct-14 18:43
professionalVivi Chellappa18-Oct-14 18:43 
AnswerRe: What is an architect for? Pin
kimpetwangi25-Oct-14 17:12
kimpetwangi25-Oct-14 17:12 
AnswerRe: What is an architect for? Pin
Richard MacCutchan18-Oct-14 21:22
mveRichard MacCutchan18-Oct-14 21:22 
GeneralRe: What is an architect for? Pin
Member 448708318-Oct-14 21:59
Member 448708318-Oct-14 21:59 
GeneralRe: What is an architect for? Pin
Richard MacCutchan18-Oct-14 22:08
mveRichard MacCutchan18-Oct-14 22:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.