5,859 reputation
1348
bio website
location
age
visits member for 3 years, 1 month
seen 2 hours ago

Feb
6
comment I have generally read that having many (>4) arguments to a function/constructor is a bad practice. Is this still considered a bad practice?
Yeah it's still bad smell because often those parameters belong together: consider the function IsEnlistAble(Age, Gender), both age and gender belong to a person, the same person, not different persons, so you would make the function IsEnlistAble(Person) that would be much clearer and if requirements change like, only males shorter then 2 meters are enlistable, then you wouldn't have to change the arguments.
Feb
6
comment Relation between object orientation and algorithms
"Why algorithms textbook are more procedure-oriented?" Java is also procedure-oriented. Java is an object oriented procedural language.
Feb
4
comment Hard Coded File Paths - Solution?
If your images aren't too big (< 1MB), then you could consider storing them in the database.
Feb
3
comment What's the benefit of GIT for solo programmer?
@gnat, your first comment links to a closed too broad question, your second comment links to a 2 closed: duplicate questions. Why would you say this question is invalid and then provide links to other invalid questions?
Jan
31
comment Should Latin-1 be used over UTF-8 when it comes to database configuration?
How much of you codebase would break when converting to UTF-8 ?
Jan
30
comment Are there any benefits of using this extra variable in the for loop annotation?
@neil this I don't see as optimization but as common sense: if you're going to get a value that you know won't change, then only get it once.
Jan
30
comment Are there any benefits of using this extra variable in the for loop annotation?
Thing is, if your array is a million items, you're going to call array.length a million times instead of 1 time while the value stays the same. Asking something a million times and knowing that each subsequent answer will be the same as the first answer......just sounds a bit nonsensical to me.
Jan
30
comment Are there any benefits of using this extra variable in the for loop annotation?
In reaction to you edit: this is object oriented programming. Standard array.length is fast and cheap. But for whatever reason, the implementation of .length could change to something expensive. If a value stays the same then don't get it multiple times.
Jan
30
answered Are there any benefits of using this extra variable in the for loop annotation?
Jan
27
awarded  Civic Duty
Jan
27
comment Why does this algorithm work in O(n m)?
The complexity is both O(n*m) and O(n^2) because m is a linear function of n.
Jan
26
comment Is the 'finally' portion of a 'try … catch … finally' construct even necessary?
@supercat nice, thanks for the extra info about Java.
Jan
26
answered Is the 'finally' portion of a 'try … catch … finally' construct even necessary?
Jan
25
comment Throw exception or let code fail
On another note: This pattern is ok for sometimes adding an item to a list. Do not however use this pattern for filling an entire list because you will run into a O(n^2) situation where with large lists you will run into performance issues. You won't notice it at 100 entries but at 1000 entries you certainly and at 10.000 entries it will be a major bottleneck.
Jan
23
answered Do I need use really INNER JOIN?
Jan
21
awarded  Good Question
Jan
20
awarded  Notable Question
Jan
20
comment One of my team members committed SQL injection-vulnerable code; should I report it to the manager?
You should have mentioned it was a hotfix. Under severe time-constraints and pressure people make mistakes they normally would not. So you can report and blame your coworker which is easy, or blame the process that got a normally fine programmer to make such a mistake in the first place.
Jan
20
awarded  Nice Question
Jan
20
comment Why sacrificing good software engineering practices is typically the first choice for software development projects assuming “good enough” quality
@ThomasOwens that's your opinion.