Violation of Software Principle [closed] - software-design

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I was reading about threads and it was mentioned that by implementing the Runnable interface, we are violating the principle that each object should have a single, clearly-defined responsibility. Can someone explain how is it that it violate the software principle ?

The principle comes from object-oriented modeling community. For example, in OO modeling, if class "A" extends lass "B", then the sentence "A is a kind of B" should make some kind of sense. Maybe the analog for class "A" implements interface "C" is "A is capable of doing C"?
Let's look at some examples:
public class Mammal extends Animal
This example reads well: A mammal is a kind of animal.
Now let's add some interfaces:
public class Mammal extends Animal implements Walking, Carnivorous
Everything is still good: A mammal is a kind of animal that is capable of walking and eating meat.
Now let's add Runnable:
public class Mammal extends Animal implements Walking, Carnivorous, Runnable
Read it: A mammal is an animal that is capable of walking, eating meat, and whose instances are intended to be executed by a thread.
That doesn't sound good. What does being a mammal have to do with the Java Runtime Environment and its threads? Should mammals know they are models running in a computer? The answer, from the object-oriented modeling perspective, is clear: mammals have nothing to do with JRE threads and should not implement the interface Runnable.

Related

Difference between iterative and incremental software process model? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed last month.
Improve this question
I have confusion in understanding the difference between iterative and incremental software process model?
what is the main reason of making these two software model if they both works same?
It's not that kind of difference to have an iterative process or an incremental process. Models use the terms to describe the process, but there are models that are both incremental and iterative.
See https://www.testingexcellence.com/iterative-incremental-development-agile/
There is a software design principal: Design iteratively, build incrementally.
From Wikipedia:
Iterative design is a design methodology based on a cyclic process of
prototyping, testing, analyzing, and refining a product or process.
...
The process should be repeated until user issues have been reduced to
an acceptable level.
From Righting Software by Juval Lowy:
While the car company may have had a team of designers designing a car
across multiple iterations, when it is time to build the car, the
manufacturing process does not start with a skateboard, grow that to a
scooter, then a bicycle, then a motorcycle, and finally a car.
Instead, a car is built incrementally. First, the workers weld a
chassis together, then they bolt on the engine block, and then they
add the seats, the skin, and the tires. They paint the car, add the
dashboard, and finally install the upholstery.
There are two reasons why you can build only incrementally, and not
iteratively. First, building iteratively is horrendously wasteful and
diffi cult (turning a motorcycle into a car is much more diffi cult than
just building a car). Second, and much more importantly, the
intermediate iterations do not have any business value. If the
customer wants a car to take the kids to school, what would the
customer do with a motorcycle and why should the customer pay for it?

Acknowledgements in an R package [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
In a package, I want to aknowledge someone's intellectual help, who has writen no code.
The question is about the best way to credit this help, as I don't find a role of persons who fits with this case.
In ?person, and "Who Did What" (The R Journal) the person's role closer to what I am looking for are:
"ctb" (Contributor): Authors who have made smaller contributions (such as code patches, etc) ...
"ths" (Thesis advisor): Thesis advisor ...
But the person whose help I want to aknowledge has writen no code, and this is not a thesis
The answer has came from the link provided by #Axeman with the full list of roles:
Consultant [csl]
A person or organization relevant to a resource, who is called upon for professional advice or services in a specialized field of knowledge or training
Consultant to a project [csp]
A person or organization relevant to a resource, who is engaged specifically to provide an intellectual overview of a strategic or operational task and by analysis, specification, or instruction, to create or propose a cost-effective course of action or solution
The question has been put on hold, if it is reopen I would like #Axeman to make his comment as an answer, to accept it.
If it is considered proper by someone with enough reputation, it could be tagged as persons, credit or attribution.
Regards.

what "concern metrics" means in Software Engineering [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Recently, I was reading a paper whose name is "On the Effectiveness of Concern Metrics to Detect Code Smells: An Empirical Study".
I come from a non-English speaking country, and I can not quite understand what Concern Metrics means in the field of software engineering.
It is not referring to the relationship between objects?
I have some understanding of java and c #, some people may be able to use java to give me an example.
Thanks.
Like it is said in the paper's abstract: "While traditional metrics quantify properties of software modules, concern metrics quantify concern properties, such as scattering and tangling." Are you familiar to the cross-cutting concern concept? This question provides examples of concerns: Cross cutting concern example Try to read papers on aspect-oriented programming (AOP) to grasp more concepts in order to understand better the relationship between concerns and code. The metrics are attempts to quantify, for instance, the amount of scatterness of a concern (e.g. login) over the source code.

Web API, where to put private methods? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
So I was wondering the other day, where to put private methods, that do some dirty work in Web API.
I need to extract certain things from JSON, methods will do the job and return some result.
So where do I keep those methods?
do I need to write a separate library (dll)?
or just do this stuff in the controller?
I don’t think it can have a single answer – it depends on…
If you think this private method can be reused from some other controller in future, better to have a separate class, if you think it can be reused from separate modules (not just from controllers), a separate class library project can be the answer.
But if you consider this private method is designed to support for a specific action of a controller, you can write within controller, before taking any decision a few more parameters to be considered like unit testability or slimness of API etc.
You should keep your controller thin as much as possible. You can move logic code to service package, for example JSONService class or JSONLib.
I often use following layout:
controller/
lib/
service/
model/

Modeling discussion topics in Inform 7 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm trying to make it so that a player can ASK [PERSON] ABOUT [TOPIC], TELL [PERSON] ABOUT [TOPIC], or THINK ABOUT [TOPIC] in Inform 7. I started like this for modeling THINK ABOUT [TOPIC]:
A topic is a kind of thing. A topic is either known or unknown. A topic is usually unknown.
Pondering is an action applying to one thing. Understand "ponder [something]" as pondering. Understand "think about [something]" as pondering.
Carry out pondering:
If the noun is a topic, say "[description of noun]" instead.
But then I realized that I'd probably want the same mechanism to be used for thinking about both abstract topics and concrete things. I've also got the problem that unless the topic is a concrete thing that is present in the room, Inform considers it out of scope. I don't know how to solve that. At the same time, I do want most topic to start out as out of scope, but come into scope as they are suggested by previous topics.
In thinking about what I'm trying to accomplish, it seems rather similar to the system used by Emily Short et. al. in Alabaster. The source imports an extension called Threaded Conversation, but I don't see where that comes from.
In short, I need a conversation system which:
allows discussion of both objects and abstract concepts,
allows discussion of things not present,
restricts discussion to things the player is aware of, and
allows new topics to be brought into scope by other topics.
Your best bet at this point probably is to adapt Eric Eve's Conversation Package to your needs; it's found here: http://inform7.com/extensions/Eric%20Eve/Conversation%20Package/index.html.
The system Alabaster uses isn't yet released.
(also, it's pretty awesome to see I7 questions here, but if you have pressing technical questions you're probably better off at the Intfiction forums).

Resources