Reputation
1,162
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
6 15
Newest
 Yearling
Impact
~30k people reached

  • 0 posts edited
  • 1 helpful flag
  • 82 votes cast
Jul
22
comment Why dynamic memory allocation functions in C returns void*?
This is because these methods are allocating memory without any specific type. If malloc returned int* and you allocate only 1 byte, you would never be able to dereference it safely without casting.
Jun
26
comment Should you write your back-end as an API?
Is the assumption that the API (assembly) must have some sort of web interface? I see no reason why the API could not live within the same AppDomain as the MVC app. If you wanted to offer a Rest interface, you would reference the same API with the approperiate end-points.
May
20
comment Example of writing unit test for a method
My obj-c is rusty, but if Crashlytics is a static instance, there's probably not much you can do. You could write an instance wrapper for Crashlytics, inject it, and test that it gets invoked correctly, but if you already have working code I probably wouldn't bother for something so simple.
May
15
comment Is it a good idea to install more libraries than you need?
I try and not predict the future, writing code takes time, and that's time wasted if it's never used. In addition, if the code is not currently used, we don't know if it will even be correct when we do need it. Your problem is a little bit different as you're not writing code, but you are still configuring an environment which takes time. Even if the time is negligible, it may be overwhelming to look at many dependencies to try and find what you're looking for.
May
15
comment Is it a good idea to install more libraries than you need?
Rhetorical response: is it a good idea to write a method that is not used now but may be used in the future? This doesn't answer the question, but that's my opinion on installing things that are not needed.
May
15
comment Unit-testing on higher levels of architecture
@RobertHarvey I don't understand the question as methods being static and methods being idempotent are orthogonal. In my answer I used examples where the complex scenario has side effects where the simple scenario is pure and idempotent. Quite often it's the side effects you want to avoid when testing a unit, instead you would test that the dependency that would causes a side effect is invoked with the correct parameters, and that the caller handles the mocked result correctly.
May
15
comment Unit-testing on higher levels of architecture
Most definitely, the point I'm trying to make is there is no one-size-fits-all for unit testing.
May
15
comment How to explain design decisions when refactoring code
Thanks for this answer. The reason why I was changing that implementation is I was using it in a new web project that has a lot of unit tests and an IoC container. The main issue is that the project in which this library lies does not have any consistency I can discern.
May
15
comment How to explain design decisions when refactoring code
I actually do have an extension method on my ICacheProvider that does something similar.
May
4
comment Why do methods that take an unlimited amount of parameters often define overloads with fewer parameters?
Another thing to note is that passing Combine with zero or one path segments does not even make sense, yet the params version allows you to do this.
Apr
15
comment TDD Red-Green-Refactor and if/how to test methods that become private
Making private methods is the result of the refactoring of public methods in the TDD refactoring step.
Apr
14
comment Calling RESTful service from browser and handling 4xx class responses
This was one of my thoughts on the subject, and it sounds like it's the way to go, however, I'm going to wait a bit to see if there's any opposing viewpoints.
Apr
14
comment Calling RESTful service from browser and handling 4xx class responses
The intended end-user is the general public, I'm more concerned about possible unintended consequences of having 404 represent a valid response. If the consumer was not a browser I would not be concerned.
Apr
9
comment is there a cleaner / simpler way to code this?
I sometimes do this and make an array of where predicates, then I join the array with ' AND '
Apr
9
comment Unit testing and reusing extracted class
@DocBrown I ended up going with this solution, the QuickOrderService I ended up mocking out the dependencies ensure its correctness.
Apr
9
comment Unit testing and reusing extracted class
@Euphoric Thanks for the blog post, looks to be a useful pattern to follow.
Apr
8
comment Should one use Dependency Injection even if the class is used only once?
I never took the reading comprehension 101 course.
Apr
8
comment Unit testing and reusing extracted class
Not sure what you mean about rules of usage, but we use it primarily to group operations to ensure they're done atomically. Primarily it's an abstraction over a a database transaction and fires domain events when the tx completes.
Apr
2
comment Fixing class Hierarchy design mistakes due to incorrect inheritance
The consumer of the interface may be a machine that holds onto tails and wags them.
Apr
2
comment Fixing class Hierarchy design mistakes due to incorrect inheritance
Right, it all depends on what the expectations there are around that method. I made some assumptions and labelled it as an LSK violation based on the fact that OP never defined what the expectations were.