Reputation
7,907
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
3 25 54
Newest
 Good Answer
Impact
~257k people reached

Aug
20
comment Is using hashes for primary keys a good idea?
@DocDrown if I didn't go crazy, I remember he wrote something to this effect in a comment below my question which - however - seems to be deleted now. I don't lose sleep over downvotes :)
Aug
20
revised Is using hashes for primary keys a good idea?
added 680 characters in body
Aug
19
comment Is using hashes for primary keys a good idea?
@DocBrown note that I'm not saying hashing is bad here. I just think that using GUIDs is good enough, and it has an advantage of being braindead simple, since GUIDs are independent of the data which they identify. Generating a GUID could also be faster than hashing, although it depends on implementation details of course.
Aug
19
comment Is using hashes for primary keys a good idea?
@DocBrown I'm admittedly not an expert in the field, but length of output by itself is not an issue, any hash function will still return the same output for the same input (that's sort of the point). If personalId + "+" + prefix + sectorId is guaranteed to be unique, then perhaps it could even be used raw, why not, SHA1 doesn't add any extra uniqueness. The problem - as I understand it - is that this formula may not yield unique outputs, especially if the system is expected to function for a long time (maintainability reasons might require eg. adding more sector IDs - caution advised)
Aug
19
comment Is using hashes for primary keys a good idea?
@Bozho I know, I've got +1 / -1 :) Your question was downvoted too
Aug
19
comment Is using hashes for primary keys a good idea?
Why the downvote? If you disagree with my answer, please take an opportunity to point out what it is so I can improve it
Aug
19
comment Is using hashes for primary keys a good idea?
@Bozho I think your suggestion is as good as it gets. Using random 128-bit identifiers keeps things simple (big plus already), and you can always prefix these values with something meaningful if you want. The only downside is that the resulting values would be long, but well, you can't have everything. I suppose they wouldn't be normally visible to anyone anyway - not be used as some PINs people are expected to quote over the phone.
Aug
19
answered Is using hashes for primary keys a good idea?
Aug
15
comment C# - design to parse and write csv and manipulating data
@SabVenkat yes, it's actually preferable if you wrapped it all in another class (not Main). A class taking an IReader, IWriter and an IExpenseCalculator, and putting them together to use. Of course if it's just a one-off, throw-away program, having clean design doesn't matter very much, but since you're asking about it...
Aug
15
comment C# - design to parse and write csv and manipulating data
@SabVenkat I don't know what it does exactly, but one step towards a better design would be to make it accept "pure" data (Customers) and spit out processed data at the end. But leave the file system out of it. The class wouldn't care if they were only just read from a csv file, nor what is going to happen with them afterwards.
Aug
14
comment C# - design to parse and write csv and manipulating data
@Laoujin it's not clear whether he actually wants to implement parsing from the ground up, his classes could be just wrappers around some library calls (adding custom error handling, for instance). If not, then you're definitely right. Parsing CSV isn't nearly as easy as it might seem!
Aug
14
reviewed Approve C# - design to parse and write csv and manipulating data
Aug
14
revised C# - design to parse and write csv and manipulating data
added 163 characters in body
Aug
14
revised C# - design to parse and write csv and manipulating data
added 243 characters in body
Aug
14
revised C# - design to parse and write csv and manipulating data
added 243 characters in body
Aug
14
answered C# - design to parse and write csv and manipulating data
Aug
13
revised Calendar/Planning algorithm
added 271 characters in body
Aug
13
answered Calendar/Planning algorithm
Aug
4
comment What was the reason for the creation of boolean variables?
There is, however, thedailywtf.com/articles/What_Is_Truth_0x3f_
Aug
4
comment SRP and Getters/Encapsulation
I certainly don't think it should be deleted : ) Although I believe the question remains open, and the gist of it is: how to tell whether behavior X belongs to class A or not; what's the litmus test for that