9,139 reputation
1636
bio website
location
age 33
visits member for 4 years, 5 months
seen 2 days ago

C:>If you're happy and you know it, syntax error! Syntax error

C:\>If you're happy and you know it, syntax error!
Syntax error

C:\>If you're happy and you know it, then you really ought to show it.  If you're happy and you know it, syntax error!
Syntax error

2d
answered Architecture: Are form default values considered business logic and where should the logic to calculate them be placed?
2d
comment Converting from byte[ ] to user defined type
@Hashtag Then you should decrypt the bytes, then use those bytes to create the object. If the encryption process isn't lossy and if Message is in classpath at the destination (same version), then you should be able to reconstruct Message on the other side. So either there is another factor at play, or one of these two conditions is not met.
Apr
16
comment Converting from byte[ ] to user defined type
@Hashtag Could you explain it more clearly in your answer? I'm not familiar with the ECC, but if the problem isn't directly related to usage, I can probably help you.
Apr
16
revised Converting from byte[ ] to user defined type
added 11 characters in body
Apr
16
answered Converting from byte[ ] to user defined type
Apr
15
revised performance versus reusability
added 97 characters in body
Apr
15
answered performance versus reusability
Apr
15
comment performance versus reusability
I don't think it is necessary to open the recordset for the caller, but otherwise I agree.
Apr
15
comment performance versus reusability
While what you say is true in general, something should be said for writing code to protect against any possible case vs having prerequisites. In my humble opinion, there is nothing wrong with simply expecting that the recordset is already open when called, given enough documentation. If anything, if this is a method in a library, perform a quick check if it is open, and if it isn't, throw an exception. No need to "make it work" in any possible scenario.
Apr
15
comment How can I Identify which condition satisfied the if statement?
If you need to do something in each case anyway, it would be simpler to simply have if(A) { ... } if (B) { ...} .... If you need something to be performed if you entered one of these if clauses, set a boolean to true and after you've done operations for A, B, C, and D, add a fifth block for the case in which your boolean is true.
Apr
14
comment Mutable with logic inside or immutable with logic outside?
@MikeNakis We should assume RECT is immutable for the sake of argument. However, you're right about being able to assign these properties causing TextDrawer to not be immutable.
Apr
7
revised Quicksort and middle pivot
Added a note for pivot
Apr
7
comment Quicksort and middle pivot
@DonHatch Hmm, good point. I'll change my answer.
Apr
3
comment Quicksort and middle pivot
@DonHatch Which is generally why you don't use quicksort to resort an otherwise sorted array after you've added a new item. You should use insert sort. I'm not going to justify using the right technique on the wrong algorithm, since you should just be using the right algorithm to begin with.
Apr
2
comment Quicksort and middle pivot
@DonHatch Good thing I wrote "If the array is unsorted.." then isn't it? Otherwise that might have been misconstrued.
Apr
1
answered What kind of base for Decorator: interface, abstract class, non-abstract
Mar
26
comment Would there be any benefit to writing synchronous code using the syntax of promises
@stimpy77 I don't quite understand how you derived that conclusion. If you're using bluebird or q, you can simply choose to not update your library if you don't want problems caused by "newer runtimes that no longer support promise-sequencing syntax." That said, this is a bit like saying that you shouldn't use functions in javascript because future ecma versions may no longer have the same syntax. I think you're fairly safe on that front, at least for the immediate future.
Mar
25
comment Objects or primitives as arguments
What I mean was that if the purpose of Point is purely to pass a parameter to a method, I have to question the usefulness of Point. However, you should generally tend to prefer the use of objects like Point over passing two primitives, but only if you intend to make use of Point. This is, afterall, the scope of object-oriented programming in the first place. If your library is going to accept Point just to take the x and y components and put them in some array immediately afterwards, you shouldn't accept Point at all.
Mar
25
comment Objects or primitives as arguments
I think the use of Point is fine, assuming you use Point, and not break it down into its x and y primitives immediately afterwards. That would mean creating an instance only to not use it is somewhat silly. Consider also that Point can always be extended to include useful calculation methods with other points in the future. To achieve the same effect with integer parameters, you'd have to create the instance in the method that requires these calculations.
Mar
23
comment When is it a good idea to force garbage collection?
@usr Frankly, I don't see why you couldn't have both. It makes sense to want to garbage collect prior to performing a heavy calculation that would require a bit of memory, however if such a request were a bad idea to do at the time, only the garbage collector would truly know.