Reputation
791
Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
3 12
Newest
 Custodian
Impact
~53k people reached

  • 0 posts edited
  • 1 helpful flag
  • 52 votes cast
Jan
27
comment I think fan-in fan-out is backward, please explain
@nocomprende I suppose I can say I'd never heard "fan-in" or "fan-out" used for types of graphs other than electrical circuits either. I work with call and data-flow graphs on a daily basis, but we're not working on metrics of coupling in software systems, so the size of the set of in/out edges isn't particularly interesting to us. But I see how someone working on that problem would be tempted to broaden the terms "fan-in" and "fan-out" as generic directed-graph terms for the counts of in/out edges, as they are, in a certain sense, counts of directed edges in a graph of an electrical system.
Jan
27
comment I think fan-in fan-out is backward, please explain
@nocomprende Functions do receive inputs from their callers...but they aren't electrical diagrams or Simulink models, where data flows are the feature that's visibly exposed. Structured programming is about delegating responsibility for performing arbitrary tasks; it's the steps required to perform a task that the code expresses. In object-oriented programming, the data is intended to be encapsulated: protected from manipulation, and hidden from the consumers of services provided using that data, so the data can change more easily, as long as it supports the required services.
Jan
25
comment I think fan-in fan-out is backward, please explain
@nocomprende I'm not an expert in electronics by any means, but my feeling is that in the world of digital electronics, the meaningful direction is defined by causality, rather than the actual movement direction of electrons, etc. Wouldn't fan in be the set of traces from which the incoming signal comes, regardless of which direction the electrons are actually flowing? Wouldn't the fan out be the set of outgoing traces that carry the signal that is propagated after our component's latency, regardless of what type of flow is propagating the signal?
Oct
26
comment When is it not appropriate to use the dependency injection pattern?
@RichardTingle The major upside of that approach is that you're very independent of your data source. The major downside is that when you receive the wrong data, you have to figure out where the data came from.
Oct
26
comment When is it not appropriate to use the dependency injection pattern?
@RichardTingle Sure, it's usually desirable to construct your dependencies yourself, which is part of what my answer is saying. I think the benefit usually comes when you wish your code didn't have to know how to retrieve some piece of data, e.g. with Guice, to produce a greeting you can write @Provides @Greeting public static void String helloDI(@Inject @Name toGreet) { return "Hello " + toGreet + "!";}, as long as at least one function (whose dependencies are available) @Provides @Name.
Mar
23
comment How to create a Web app that “interacts” with email?
Do remember that anyone can spoof the from field, so you shouldn't design a system this way if there's any potential for benefit by third parties, or potential for serious harassment to your clients. If there is, you probably need something more secure than email.
Nov
18
comment Can you explain me why multiple threading need lock?
The quote looks much more applicable for threads to me (with the words/characters being printed out of order due to threading issues). But there's currently an extra "s" in the output, which suggests the code has three problems.
Nov
18
comment Can you explain me why multiple threading need lock?
I've updated my answer to address some of these concerns: yes, you can make the operation atomic, but no, even on architectures that support it, it won't be atomic by default, and there are situations where atomicity isn't enough and full serialization is needed. Locking is the only mechanism I'm aware of for achieving full serialization.
Sep
4
comment Should interfaces extend (and in doing so inherit methods of) other interfaces
The usual language is that an interface "extends" its parent, and (in doing so) "inherits" the methods of the parent interface, so I'd recommend using "extend" here.
May
13
comment What is meaning of a HINT when used in software engineering?
@AaronAnodide I'd say the answers you've gotten are good enough to justify keeping the question: it makes the internet better for anyone else that wonders whether "hint" has a special meaning in software engineering, and looks for a definition.
Apr
16
comment Strategies for avoiding SQL in your Controllers… or how many methods should I have in my Models?
-1 for "There's no correct way to do this". There are several correct ways. Doubling the number of methods when you add a feature as the OP was doing is an unscalable approach, and the alternative suggested here is equally unscalable, just with regard to database size rather than number of query features. Scalable approaches do exist, see the other answers.
Feb
22
comment When is it not appropriate to use the dependency injection pattern?
SRP = single responsibility principle, for anyone else wondering.
Feb
22
comment When is it not appropriate to use the dependency injection pattern?
There wouldn't be so much cost to having an extra constructor used for testing only that allows the dependencies to be injected. I'll try to revise what I said.
Feb
22
comment When is it not appropriate to use the dependency injection pattern?
You misunderstand, I'm not talking about when you inject a mock, I'm talking about the real code. Consider class A with dependency B, which in turn has dependency C, which in turn has dependency D. Without DI, A constructs B, B constructs C, C constructs D. With construction injection, to construct A, you must first construct B, to construct B you must first construct C, and to construct C you must first construct D. So class A now has to know about D, the dependency of a dependency of a dependency, in order to construct B. This leads to excessive coupling.
Feb
11
comment Why do variables need a type?
You're right, static/dynamic is what I should be using here, fixed.
Feb
11
comment Why do variables need a type?
I'm pretty sure the closest you can get is C#'s var, where the type is still determined statically, but you don't have to spell out what the type is. That said, for clarity reasons, it's usually better to say the type explicitly in C#, since it means you can easily see the type of the variable when you have to modify your code six months down the line.
Feb
11
comment Why do variables need a type?
In most languages that I'm aware of, whether statically or dynamically typed, 10 + "10" is valid code. It's valid in Java, C#, VB.net, JavaScript...only one I'm sure it's not valid in, off the top of my head, is C.
Feb
11
comment Why do variables need a type?
I've given an example above in which you can't know the types of the objects statically...depending on the path of execution, the type of object stored in a variable with no type information can be different. You can have a language like C# where the compile-time type information can be inferred, but, so far as I know, there's no language with both static type-checking and truly typeless variables, the computational complexity of the static analysis is likely too great.