What are the differences between Abstraction and Decomposition? [closed] - uml

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
In software engineering there are two main concepts in design phase which are abstraction and decomposition but I can't get the differences between them?

Both concepts are analysis & design basic techniques. There are interrelated and normally used together during software development. We use them even though we are not always aware of it. Deeper understanding of these concepts helps to be more accurate and effective in A&D.
Abstraction in general is process of consciously ignoring some aspects of a subject under analysis in order to better understand other aspects of it. In other words, it kind of simplification of a subject. In software in particular, analysis & design are all about abstraction.
When you model your DB, you ignore UI and behavior of your system and concentrate only on DB structure.
When you model your architecture, you concentrate on high-level modules and their relationships and ignore their internal structure
Each UML diagram for example gives a special, limited view on the system, therefore focusing on a single aspect and ignoring all other (sequences abstract objects and messages, deployment abstracts network and servers, use cases abstract system users and their interactions with a system, etc)
writing source code in any programming language requires a lot of abstraction - programmers abstract app's functionality using limited set of language constructs
Decomposition is an application of the old good principle "divide and conquer" to software development. It is a technique of classifying, structuring and grouping complex elements in order to end up with more atomic ones, organized in certain fashion and easier to manage. In all phases there are lots of examples:
functional decomposition of a complex process to hierarchical structure of smaller sub-processes and activities
high-level structure of an complex application to 3 tiers - UI, logic and data.
Class structure of a complex domain
namespaces as a common concept of breaking a global scope into several local ones
UML packages are a direct use of decomposition on the model level - use packages to organize your model
Abstraction is somehow more generic principle than decomposition, kind of "father of all principles" :)

Abstraction is one of the fundamental principles of object oriented programming. Abstraction allows us to name objects that are not directly instantiated but serve as a basis for creating objects with some common attributes or properties.
For example: in the context of computer accessories Data Storage Device is an abstract term because it can either be a USB pen drive, hard disk, or RAM. But a USB pen drive or hard disks are concrete objects because their attributes and behaviors are easily identifiable, which is not the case for Data Storage Device, being an abstract object for computer accessories. So, abstraction is used to generalize objects into one category in the design phase. For example in a travel management system you can use Vehicle as an abstract object or entity that generalizes how you travel from one place to another .
Decomposition is a way to break down your systems into modules in such a way that each module provides different functionality, but may affect other modules also. To understand decomposition quite clearly, you should first understand the concepts of association, composition, and aggregation.

Related

How do I create class diagrams from Use Cases? [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 1 year ago.
Improve this question
I am coming from the Embedded Systems domain with more than 3 years experience.
In my current project, at the beginning, I was only responsible for only software development and the Team consisted of 3 people.
But, as time passes, hardware eng. and project lead eng. left the job respectively. So far, the project moved with a zero- architecture documentation to give an output as fast as possible. Later, new project lead took over the project and started from the begining with applying V-model. We started to create product specs->HLR->DLR on EXCEL. But now, He left the job too :). Now, I am alone on my way with nearly 700 pieces of well written product requirements. Anyway, I started to gathering and classfying requirements as non-functional, functional, business, stakeholder etc. As gathering non-functionals, I also classified them scalability, performance, regulatory, design contrains etc. So far, I did not draw any use-case. Please verify me here, what I know is that input of use-case are functional requirements. So, I created a use-case cards and now I am planning to write use-case cards for each functional requirements then also write a sequence diagram for each use-case card. Now till here, am I going right ? Does notations used in use-case such as include, extend etc. help me to create class diagram ? Is this also right way ?  
Can classes be derived from use-cases?
When Ivar Jacobson invented use-cases he aimed at a development method that would be driven by the use-cases and allow to methodically derive the implementation from the use cases. That was his vision end of the 80s. His first attempt was called Objectory, which was bought by a larger company and lead to Rational Unified Process, which was generalized to be less proprietary into the Unified Software Development Process (Unified Process, or UP in short).
There is in particular one practice that allows to translate a use-case into classes: the Entity Control Boundary approach: use-cases become «control» classes, links between use-cases and actors become «boundary» classes, and «entity» classes are created for the business objects identified in (or derived from) the use-case narratives.
Once these first candidate classes are modelled, further work is undertaken during the design and classes may get reorganized to best fit into the solution (e.g. several boundary classes are regrouped for designing the GUI, and may thereafter be decomposed into UI elements, etc...).
But is this the best approach in your case?
UP is iterative and incremental, and fits well into modern version of the V-model, since the early iterations of the elaboration phase aim to stabilize the architecture and teh components (or sub-systems).
However, this may be a very time-consuming approach, especially considering the huge number of use-cases that you have. If you look at all the questions that modelling a use-case usually raises, especially if you add «include» and «extend», you risk to spend a lot of time (more than 300 days?) to draw robust use-case diagrams. And then, using ECB, your requirements might be outdated before you finish the design!
Alternatives
On the other side, some non-academic authors claim that every system has 3 to 5 really main use-cases: as a user I don't have 700 goals for using a system. So you'd better identify these and see how they relate. It's probable that many of the other requirements are far too detailed and could easily be assigned as additional information for the main use-cases.
In a similar thought, Ivar Jacobson has adapted his method to the current software engineering reality, with the use-case 2.0 approach. Don't misunderstand me, the UML would still be the same, but ECB no longer appears (modern frameworks influence much more the design of the boundaries than the use-case model, and entities are modelled using more focused approaches, such as DDD).
The idea behind use-case 2.0 is to slice the main use-cases into several smaller parts and start to develop something that makes sense for the user and can then be further refined.

Difference between UML 1 and UML 2? Which one should I be focusing on?

I was given a special task to learn and discuss about UML at work. I have a little background about the topic, though I'm not sure what area should I give more priority since UML has now multiple versions. Should I stick with the the UML first version and give an overview for the UML 2 instead? or should I focus more on the UML 2 since it's the latest version? I'm confuse since I'm not familiar with the difference of the two versions.
I need advise regarding the matter. Thank you in advance. Pardon if this question is irrelevant in this site.
It might be practically difficult to restrain to UML 1 just for the following reason: Nearly all available tools for drawing diagrams implement UML 2 since long time ago. So, each time when drawing some construct, you would manually have to check whether it was already available in UML 1.
The step from 1 to 2 was in a large part motivated by the software engineering hype named MDA (Model Driven Architecture) some 10..15 years ago. This was about generating software directly from the model. To support this, all model elements got defined via some formal semantics. Also, some model and diagram types got enhanced. Sequence diagrams were enriched to control structures to express control flows. Component and deployment diagrams got enhanced.
Now, apart from suggesting that it won't make much sense to go back to UML 1, I read from your question that you need to set priorities. That makes sense, as the definition of UML (1 as well as) 2 is quite lengthy, and you don't want to study every detail of it. So here are a few hints:
With object oriented technology everywhere around, class modeling is the central notion. So you should be familiar with classes, associations, aggregations, composition, inheritance, attributes, operations and their parameters and results, visibility of methods and attributes, abstract classes and methods, and interfaces.
Objects of a class change their states by application of their operations. A central, and sometime underestimated, type of model therefore is state modeling. Here, UML offers two partly redundant model and diagram types: State and activity models. You should get familiar with at least one of them -- switching to the other should then be not too difficult.
Most users of UML are quite fond of use case modeling. I'm not, as those use cases tend to lack either significance (if you constrain to naming use cases and actors) or structure (if you start documenting system data and functionality with your use cases). But the rest of the world will only accept you as an UML expert if you know them, so you won't be able to avoid them. Just before using them extensively, think about how to reach the DRY (don't repeat yourself) principle when describing a system via use cases.

Modelling a domain 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 5 years ago.
Improve this question
I have a scenario which involves a vending machine and then asks us to create to "model the problem domain". I've covered modelling very loosely and was hoping someone would clear this up.
From research it looks like a problem domain is just a domain model which in turn is pretty much a UML Class Diagram.
The examples I've seen look they're almost database schemas with a customer entity, order entity etc etc.
I'm just not sure what the differences are exactly.
So I just wondered if I was on the right track and would anyone mind elaborating on this or perhaps pointing me towards a concise definition. Thanks.
The "problem domain" is just the stuff you're interested in. In your case, it's all the stuff a vending machine does, and who interacts with it.
It boils down to a collection of use cases, which can be diagrammed in a use case diagram. What does the vending machine do? It takes coins from a buyer (the actor), gives change (maybe...so make sure you understand "extension points"), spits out stuff (always, because we aren't in the real world), and so on. Then maybe you can get creative with a different actor. A maintenance person takes out money, adds change, fills up the machine, runs a diagnostic stack, whatever. Each one of these is a use case. Put them together into a use case diagram.
If you want to go into detail about what each use case does, then use an activity diagram. One for each use case.
Any system (software or not and modeled or not) has structural and behaviour aspects.
The structural aspects are non-time bound aspects of your system, such as which classes your system is made up of, their associations and dependencies, how they are divided into subsystems, etc. Most of these elements are often referred to as classifiers.
The behaviour aspects shows how these structural aspects collaborates together over time to achieve the goals of the system, such as methods, state machines, workflows, use case realisations, etc.
The structural and behaviour aspects are what you specify when you are writing your code or creating a model.
Objects, are by definition instances of classes. This means that objects are the "things" that actually exists when the system executes. Hence, you do not program an object; you program a class, which when executed, is instantiated into one or several objects.
However, in many modelling languages (but not common in programming languages), you can also model specifications of scenarios, which show specifications of objects and how they interact, for example in UML you may create an object diagram, showing one example of how the system of objects (i.e., instantiated classes) might be structured and collaborate during execution.
Now, a system always strives to a achieve one or several goals for it's surrounding. The surrounding is made up of persons and/or another systems (actors) interacting with the system. This "surrounding" or "background", on which the system is situated in and makes sense in, is often called the "domain".
These "actors" have a "problem" they would like that the system helps them to solve. When this problem is modelled, one calls that model the "problem domain model" for the system. It states the logical structural and behaviour aspects of the problem domain, without stating how it is going to be implemented in a specific implementation of a system. I.e., it is not referring to implementation aspects, like Java, SQL, primary keys, transactions, reflection, angular, etc; it is instead focusing on the core structures of the domain, like Orders, Parties, Contracts, Products, etc.
The problem domain model is one of the most important "contracts" between the system developers and the persons paying for the system or being owners and users of the system. It makes it possible for you all to understand the problem to be solved in the same way and are makes sure that you all are using the same concepts to reason about it. Since it, by definition, is not a technical artefact, you should describe it using as simple notation (but still stringent and crisp clear) as possible so that also non-software professionals could understand and agree on it. Class diagrams (stripped from all technical details) and use case diagrams are two notation techniques available. But also object diagrams and activity diagrams could come in handy.
If you are interested in this, I deliver a course in advanced concept domain modeling on Udemy. Here is link and 90%-off code: https://www.udemy.com/get-your-concepts-straight/?couponCode=CONCEPTS29
Regards
Per

How to model logic of complex operations [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 8 years ago.
Improve this question
How to model logic of complex operations? For example save methods for root entities where state, versions and various atributes should be handled according to some logic. DTOs and entities exist.
I was thinking about sequence diagram, activity diagram, natural language and some abstract code.
I think sequence diagram is not appropriate because it's more likely for modeling of an interaction.
Activity diagram seems to me too clumsy and I don't know where to put instructions like assignments of attributes. It doesn't look right in a note or description of an activity.
Natural language is ambiguous and there is little information in large volume.
Mayby abstract code could be the right choice. Or its combination with natural language. Is there any recommended form? I don't want to write Java code.
If you mean - complex algorithms, they are probably best modelled by activity diagrams. Since UML 2.0 they have actions for practically all kind of operations (including assignements). That's not the problem.
I agree though that in some cases it would maybe better to use some more informal approach. Activity diagrams are very slow to draw and to layout and the added value is questionable (if no automation is used later on). Regarding the statement that they are "clumsy" - you can always overcome this problem by a nice structuring and hierarchical breaking your model in several levels (as single activities can contain whole diagram inside them).
Maybe a mix would do the work - outline the main steps of the algorithm, maybe main decisions, loops, invocations, whatever is importang for you. Later add detailed description of those single activitis: using pseudo-code, natural language or even another embedded diagram (states, activities).

What is Domain Driven Design (DDD)? [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 5 years ago.
Improve this question
I keep seeing DDD (Domain Driven Design) being used a lot in articles - I have read the Wikipedia entry about DDD but still can't figure out what it actually is and how I would go about implementing it in creating my sites?
Firstly, if you don't know that you need it then it's possible that you don't need it. If you don't recognize the problems that DDD solves then maybe you don't have those problems. Even DDD advocates will frequently point out that DDD is only intended for large (>6 month) projects.
Assuming that you're still reading at this point, my take on DDD is this:
DDD is about trying to make your software a model of a real-world system or process. In using DDD, you are meant to work closely with a domain expert who can explain how the real-world system works. For example, if you're developing a system that handles the placing of bets on horse races, your domain expert might be an experienced bookmaker.
Between yourself and the domain expert, you build a ubiquitous language (UL), which is basically a conceptual description of the system. The idea is that you should be able to write down what the system does in a way that the domain expert can read it and verify that it is correct. In our betting example, the ubiquitous language would include the definition of words such as 'race', 'bet', 'odds' and so on.
The concepts described by the UL will form the basis of your object-oriented design. DDD provides some clear guidance on how your objects should interact, and helps you divide your objects into the following categories:
Value objects, which represent a value that might have sub-parts (for example, a date may have a day, month and year)
Entities, which are objects with identity. For example, each Customer object has its own identity, so we know that two customers with the same name are not the same customer
Aggregate roots are objects that own other objects. This is a complex concept and works on the basis that there are some objects that don't make sense unless they have an owner. For example, an 'Order Line' object doesn't make sense without an 'Order' to belong to, so we say that the Order is the aggregate root, and Order Line objects can only be manipulated via methods in the Order object
DDD also recommends several patterns:
Repository, a pattern for persistence (saving and loading your data, typically to/from a database)
Factory, a pattern for object creation
Service, a pattern for creating objects that manipulate your main domain objects without being a part of the domain themselves
Now, at this point I have to say that if you haven't heard of any of these things before, you shouldn't be trying to use DDD on any project that you have a deadline for. Before attempting DDD, you should be familiar with design patterns and enterprise design patterns. Knowing these makes DDD a lot easier to grasp. And, as mentioned above, there is a free introduction to DDD available from InfoQ (where you can also find talks about DDD).
Take StackOverflow as an example. Instead of starting to design some web forms, you concentrate first on doing object-oriented modelling of the entities within your problem domain, for example Users, Questions, Answers, Votes, Comments etc. Since the design is driven by the details of the problem domain it is called domain-driven design.
You can read more in Eric Evans' book.

Resources