Role of class diagram in real world system implementation - oop

I have designed the domain models of my system by using class diagram. It only includes the business domain logic of my system but not application logic that will be affected by the choice of platform, tools and programming language. This is all right in the analysis stage because no implementation detail is required yet.
However, I found that the class diagram that I have designed in the analysis stage is not sufficient to be used as the blueprint to develop the system in the implementation stage due to the lack of application logic, presentation logic and persistence logic details. Do I need to re-design the class diagram or create another type of diagram to serve as the blueprint for implementation?
I did not have any real world experiences in designing and implementing a system from the start to end so I would like to have some insights on the role of class diagram in real world system development.
The book - Applying Use Case Driven Object Modeling with UML has defined analysis-level class diagram as the class diagram that includes domain models while design-level class diagram is the class diagram that is "closer" to the source code implementation. However, I could not find any example of design-level class diagram and do not know what should be included in the design-level class diagram.

This is going to be a long story, so I try to make it short. You were so far only on a certain level of abstraction. But once you reach the borders you need to extend your model. A good way it the use of Model Driven Architecture (MDA). Here you introduce 3 layers called
CIM Computation Independent Model,
PIM Platform Independent Model and
PSM Platform Specific Model
While the CIM only looks a requirements and use cases and talks about business the PIM concretes this layer and forms classes (the level you were looking at). Finally the PSM models concrete things as hardware where the system will be deployed.
There are quite a number of different processes which deal with creation of such a model. I once made a good start with ICONIX but RUP is also widely used (though much more complex).

Related

difference between system design and object oriented design

can someone please explain the difference between system design and object oriented design?
Object oriented design involves object modeling and uses object oriented concepts such as Abstraction, Encapsulation, Decomposition and Generalization. Both of the design involves Architectural design and conceptual design.
Is one of the design paradigm subset of other?
System design is the designing the software/application as a whole [high level] that may include analysis, modelling, architecture, Components, Infrastructure etc. whereas the objected-oriented design is the set of defined rules/concepts to implement the functionalities within a software.
Take an analogy, a football game.
So the System design involves the design of football ground, goal poles, grass on the ground, location of the ground, length/breadth of the ground, putting line marks on the ground, scoreboard, defining the playing teams, number of players to play etc.
Now, take object-oriented design: how the games need to be played is defined by a set of rules that need to be followed. Thus the players need to play the game within the defined rules. So the more the player knows those rules the better they can play the game without making fouls. Similarly, the rules for the object-oriented concepts are inheritance, composition, abstraction, encapsulation. Thus the better we know these concepts the better design we can make.
#Prashant, hope it explains a bit
Let's say you want to design an online shopping web Application (like amazon.com). So before making that web application you have to think of :
load balancing to handle the user requests,
database whether to use SQL or NOSQL,
whether to use cache like Redis or not,
making microservices for the different tasks ( like notification service, order processing service etc.)
monitoring your web application (like memory, cpu etc.),
logging (say in sumoLogic).
CI/CD
So all these will fall under system design as they are required for any system to work.
Now once you finalized all these things and went to implement (writing code) any part of the system then you can follow the Object-oriented design to make classes, interfaces etc.
For example, you started implementing the notification microservice ( say in Java), so now you have to design classes, interfaces etc., and for this, you can use the object-oriented design principles like SOLID.
So we can say that object-oriented design is a part of system design which comes into picture when we start working on the actual implementation for any part of the system.
System in System Theory can be everything. (Facets of Systems Science, George Klir, 1991) System is on TOP of TREE, Superclass of other categories.
In overall, System Development included 2 major phases:
1- System Analysis: including Planning, requirements, analysis and etc. These items related to specific methodology in system theory.
2- System Design: including design, implementation, test, deploy, maintenance and etc.
As I said, System can be everything. For example:
Mechanical systems, Psychological systems, Social systems, Aircraft Systems and so on. Each category may have detailed and specific analysis and design steps based on mentioned 2 major phases.
In computer world, Software Systems is one of System categories.
Each software Analysis and Design method is based on mentioned 2 major phases too.
Additionally, In Software Systems, we have some paradigms to analysis and design like:
Structural/Process Centered
Data Centered
Object Oriented
Service Oriented
and etc.
Each of them has it's own Analysis and Design Steps. These steps are based on 2 major phases as well. But in details, they have some differences.
To sum up, Systems Analysis and Design is a big picture to all other type of systems. Learning System Analysis and Design helps to understand all other systems analysis and design and specially helps to compare and evaluate them.
Objects are parts of a system. You can think Object Oriented Design is a part of System Design. You can design a system in high level (with overview) or in low level (with details). It will highlight
Infrastructure
Data flow management
Services
Cache management
Request/response management etc
When doing object oriented design you can think that you have to use some objects and making relations among them. But before making object you need to design some classes. So actually OOD (object oriented design) is
Designing class diagram (optional)
Making some classes
Making relations among classes
Using classes for creating objects
Implementing the purpose (basic functions and logics) etc

Is there any testing on the analysis and design software?

Usually testing is done after implementation. Is it possible to test an analysis and design before write the code?
Particularly, how can the following analyses and designs be tested:
User Requirement
Use Case & Use Case Scenario
Sequence Diagram
Class Diagram
Physical Data Diagram
ER diagram
Design Interface
Pseudocode
Yes, you can test the dynamics of UML (fUML), SysML, and UPDM models using the Cameo Simulation Toolkit. Here is the brochure, where you can learn more about it.
we can do the testing on our anlysis and design with software metrics measurement. like:
Weighted methods per class (WMC),
Depth of inheritance tree (DIT),
Number of children (NOC),
Coupling between object classes (CBO),
Response for a class (RFC),
Lack of cohesion in methods (LCOM)

How to bind UML with code?

I am beginning in UML and software analyse and i do not understand how UML and diagrams can influence coding and software architecture while we can directly build the code and its data base without diagrams.
I read lot of tutorials abouat the subject but not enough to understand the utility of UML in coding.
I understand everey diagram and its role. That is not my problem but i do not yet understand their roles after the analyse and design phase.
So what is the role of UML in coding phase of a software ?
Thank you.
The comment by #xmojmr already puts it right. UML creates a model (hence the M in UML) of a system. A model reduces information of a system to a level so it is a) manageable and b) complete. Human brains are not computers and you need a means of communication what the system is all about. You can do that as pure code, as paper document and as UML model. A combination of all is not uncommon. As long as you have tiny systems you can live with pur code and tools like Doxygen. But once it starts getting complex you need some handles. UML offers these to end users, architects, testers, developers, managers, etc. Along with UML you will also need a methodology. UML delivers the syntax how to document a system. But you need some structure above to write a nice novel.
UML-based models play an essential role for coding/implementing a software system in model-based (or model-driven) development. The basic idea is that you start making a model of your problem domain (the domain model), then you derive from it a platform-independent design model, which can be transformed into platform-specific implementation models (e.g. for Java- or C#-based platforms) that are finally encoded in the target languages.
The most prominent part of model-based development is the encoding of model classes (forming the model layer in an MVC architecture for apps) based on a data model (a UML class model) that has been derived from an information design model, which was obtained from a domain information model (where all these information/data models are UML class models).
You can find an instructive example of model-based development in my tutorial book Engineering Front-End Web Apps with Plain JavaScript.
This one is in my point of view a duplicate of that other question. It can't be flagged because there is no accepted answer. The related question on meta stackexchange does not provide a clear solution to that situation.
I think my personal answer was relevant and is applicable to the current question.
To be synthetic, Martin Fowler considers current uses of UML. I think he describe the current practices. Perhaps should these evolve ?
Perhaps would the initial question be the right place to discuss ?

Why do we use UseCase diagrams in object oriented analysis and design even if Usecases are not considered as Object oriented?

UML notations says, Usecases are drawn to point out the functional requirements in the Problem Domain, it by no means gives the information about object or class as Data Flow Diagrams or Entity Relationship diagrams. But also why do we use Usecase Diagrams in object oriented analysis and design even if Usecases are not considered as Object oriented.
Use case diagram is meant to shed light on the main functionalities of the system , and emphasis the perspective presenting the latter as a blackBox merely existing for a sole mission;deliver to the actor the Promised service .
At this point we don't realy care about OOP realy , as you can definetly use Use case diagram for any other type of analysis.
UML is just a set of visual tools to allow a unified expression of different perspective of the system.
In Case you are using The Unified Process it advocates to start with identifiying the use cases first then explode every use case into collaborative entities (classes) and establish the static collaboration between them by harnessing the Class Diagram toolbox.
Object-oriented is analysis and design methodology, while use case is requirements methodology.
And be aware of the core development workflow:
Business modeling
Requirements
Analysis
Design
If we use UML to do these works, we may have:
Business use case+ Business sequence diagram
System use case+ System use case specification
Analysis class diagram+ Analysis sequence diagram+ Analysis state machine diagram
Code, Database......
UML diagrams in 3. can be replaced by DFD/ER
Kirill Fakhroutdinov's online book uml-diagrams.org defines UML as
The Unified Modeling Language™ (UML®) is a standard visual modeling language intended to be used for
modeling business and similar processes,
analysis, design, and implementation of software-based systems
UML is a common language for business analysts, software architects and developers used to describe, specify, design, and document existing or new business processes, structure and behavior of artifacts of software systems....
As such the language needs words to describe processes, their actors (the code and its users, why the code exists, what is it good for, why someone should pay a money for it..)..
If in your designs you don't need to take users and their needs into account (you have the user interface designs set and you are focusing just on a library code) then don't bother, use UML to describe the parts you are dealing with and use diagrams that are natural and useful for you (and your teammates)
Some related articles:
http://www.uml-diagrams.org/use-case-diagrams.html
http://www.jamasoftware.com/blog/when-use-cases-arent-enough-part-1/
http://agilemodeling.com/essays/agileRequirements.htm
http://www.sparxsystems.com/downloads/whitepapers/Requirements_Management_in_Enterprise_Architect.pdf
http://alistair.cockburn.us/Stop+confusing+use+cases+and+user+stories (and http://c2.com/cgi/wiki?UserStoryAndUseCaseComparison)
If well use cases diagrams are mainly intended for communication with non-technical people, I would like to add that in some software architectures (like Clean Architecture), use cases are represented as actual objects that orchestrate the entities (they are equal to services after all).
Eg.
Given the use case "Submit Issue", you can create the following definition for it:
Submit Issue Use Case
Input data:
issue_id
issue_description
date
Output data:
same input data as confirmation
Primary Course
Validate input data
Create new Issue instance using the input data
Persist new Issue
return confirmation data
As you can see in the Primary course, there is even a detectable dependency between this use case and an entity object named "Issue".
A python example for this SubmitIssue Use Case class:
class SubmitIssue(UseCase):
def __init__(issue_repo):
self._repo = issue_repo
def execute(self, input_data):
#validate input data as needed
#and apply branching logic if it is valid
new_issue = Issue(input_data) #create new issue
self._repo.add(new_issue) #persist new issue
return self._generate_output_data(new_issue)
#staticmethod
def _generate_output_data(new_issue):
#logic that returns the output data as specified
#in the use case output data definition
return output_data
regards.

ASP.NET MVC4 n-Tier Architecture: best approach

I developing a 3 tier architecture for an MVC4 webapp + EntityFramwork5.
I want to keep separete the layer, so only DAL knows that I'm using EF, for example.
Actually I have a lot of classes to manage that:
DAL
Entity POCO
Entity DataContext : DbContext
Entity Repository
BL
Entity ViewModel
Entity Service(instantiate Entity Repository)
WEB
Entity Controllers (instantiate Entity Service)
This is working but is quite hard to mantain. I was thinking to remove the Entity Repository in DAL and use directly the DataContext (if I'm not wrong, after all DbContext has been desingned to be a Repository and a Unit of Work), but that will force me to add a reference to EntityFramework.dll in my BL. Is not a big issue, but I0m not sure it is the best choice.
Any advice?
(I hope I gave enough informations, if you need more, just ask)
You can use this this and this article.
An experienced Architect does not need to go through every single step in the book to get a reasonable design done for a small web
application. Such Architects can use their experience to speed up the
process. Since I have done similar web applications before and have
understood my deliverable, I am going to take the faster approach to
get the initial part of our DMS design done. That will hopefully
assist me to shorten the length of this article.
For those who do not have experience, let me briefly mention the general steps that involved in architecturing a software below...
Understand the initial customer requirement - Ask questions and do research to further elaborate the requirement
Define the process flow of the system preferably in visual (diagram) form. I usually draw a process-flow diagram here. In my
effort, I would try to define the manual version of the system first
and then would try to convert that into the automated version while
identifying the processes and their relations. This process-flow
diagram that we draw here can be used as the medium to validate the
captured requirements with the customer too.
Identify the software development model that suite your requirements
When the requirements are fully captured and defined before the design start, you can use the 'Water-Fall' model. But when the
requirements are undefined, a variant of 'Spiral' can be used to deal
with that.
When requirements are not defined, the system gets defined while it is being designed. In such cases, you need to keep adequate spaces
in respective modules, which later expansions are expected.
Decide what architecture to be used. In my case, to design our Document Management System (DMS), I will be using a combination of
ASP.NET MVC and Multitier Architecture (Three Tier Variant).
Analyze the system and identify its modules or sub systems.
Pick one sub system at a time and further analyze it and identify all granular level requirements belonging to that part of the systems.
Recognize the data entities and define the relationships among entities (Entity Relationship Diagram or ER Diagram). That can
followed by identifying the business entities (Some business entities
directly map with the classes of your system) and define the business
process flow.
Organized your entities. This is where you normalize your database, and decide what OOP concepts and design pattern to be used
etc.
Make your design consistent. Follow the same standards across all modules and layers. This includes streamlining the concepts (as an
example, if you have used two different design patterns in two
different modules to achieve the same goal, then pick the better
approach and use that in both the places), and conventions used in the
project.
Tuning the design is the last part of the process. In order to do this, you need to have a meeting with the project team. In that
meeting you need to present your design to your team and make them ask
questions about it. Take this as an opportunity to honestly evaluate/
adjust your design.