SlideShare una empresa de Scribd logo
1 de 20
Think Again Before You Start Coding!
           Thinking Process!

                             Mahmud Hasan
                           Software Engineer
                                 Bangladesh
What we actually do in everyday programming?


We basically do just 3 things in all the applications.
1. We take input
2. We process input
3. And we generate output

     If we narrow it down more, we basically work with a single goal. That is “We want to generate output” from our
     application.

Now, think what the word “Output” actually means?


Simple – “Showing        Object!”
Example?
1. In database applications we generate views and reports.
2. In games we show different characters of the game and show change in their view based on scenario and action.
3. In console apps we save, we trigger but ultimately we do something that would be viewable somewhere.
Now A requirement comes to you and let’s walk through how we can proceed
in implementing the requirement.

•   1st of all you need to break down the requirement in single piece of functionalities. Note that
    I have bold out the word “Single”. Yes, you never implement more than one functionality at a
    time.
•   After breaking down the functionality in single units the next question you will ask yourself
    for each and every functionality is, what are the items that you will need to deal with in that
    specific functionality? The answer of this question is/are your object/s.
Example:
• Requirement (From our real life project): Extract keywords from articles and save those in
   your database. Implement search on article based on the extracted keywords.

Breakdown:
1. Extract keywords from article.
Objects: Keyword, article.
2. Save keywords to database.
Objects: Keyword.
3. Search article on keywords.
Objects: keyword, article. (Do you see any other object here? Will come to this point later.)
Context of the functionality

•   Next question you will ask yourself is, what is the context of the functionality you are going to
    implement?
•   Does the object/s of the functionality closely related with the specific Domain of your
    application? Mark that, I have bold out the word “Domain”
•   Does the object/s of the functionality can be co-related with a broader domain?
•   So, what actually you mean by the word “Domain” in software engineering?

    We all know that, an application is basically composed of several functionalities where we
    deal with different objects. So, we have 2 things here: One is objects and another is functions
    around those objects. If you think from narrow sense, your application is a closed system
    where you implement different functions to deal with different objects. From this context,
    the application will have only one kind of user: Users who gets into the application and use it.
Think Broad:
   If you think with a little broader sense, your application might have 2 type of users:
     1. Users who gets into the app and use it. You are initially develop the app for them.
     2. Users who may like to use data that you are preserving in your application. This scenario
        may come later.

    So, if the second scenario comes you will need to expose your objects and functionalities to
        the external world. Here the concept DDD and SOA comes along with OOP. (Will come to
        this point later.)

    Example: Think of FaceBook. it has many information on its members and their friends. But
       is it a closed system? No. It has exposed it’s objects to the external world and so you can
       find lot of exciting apps on facebook by many developers. Think of the facebook app on
       your windows phone. 
• Let’s come back to the question what actually the word “Domain” means.

   Domain is actually the specific area/ topic/ business that your application is going to be
   developed for. Remember the question you asked yourself earlier?




   So, The context of the functionality can be your own application domain. Or, it can be a
   broader domain where applications of other domains may also us this. So, it seems your
   object indeed has a domain and applications, including your one, of the same domain may
   use your object for different purposes. And that is how you can call your objects as Domain
   objects.
Note that, we have not thought of any database or table in analyzing the requirement.
Rather, we still are finding and analyzing the objects for the requirement.
For our specific requirement we found 2 objects: One is “Keyword” that will be extracted
from articles. And the other one is “Artcicle”.
It is obvious that the keyword extraction feature is a requirement of your application. But If
you ask yourself that if the keyword extraction feature can be useful from other applications
of different domain? Yes it can be. If we think of this feature is just extracting keywords from
a large text, it might be useful from many other apps. So, this function is not your application
domain specific. Thus the object “Keyword” can be considered as an object, but of a separate
domain than your application. The domain can be “Text” or something more generic!
“Keyword” is basically a value object of the extraction service.
 Now, the question is what is value object?

A value object of any domain or application is the object that do not have its own identity. In
other words that does not get saved in any repository. When keyword is returned from the
extraction service, it is a value object for that service.

Now, when you have received the keywords in your application the next functionality you will
need to implement is saving the keywords. This time the keyword is a domain object for your
application domain.
DDD
Now come to the object “article”. This is the object that is specific to your domain where you play
around different articles. So, it is a domain object for your application and the external world that
will deal with your domain.

So, up to this point, we have found out 2 domain objects and 1 value object out of our
requirement. And still not thinking of database table or storage.

In-fact we are approaching in Domain Driven Design (DDD) approach. (More detail of DDD is not in
scope of this presentation. See more on this here http://en.wikipedia.org/wiki/Domain-
driven_design)

Gradually your domain objects will lead you to the database and you can easily have your database
from this approach using EF 4.0 code first approach. (This is not focus of this presentation.)

More Example of Domain Object: Customer, Supplier, Book, Library, Measure, Portfolio etc.
More Example of Value Object: SearchCriteria, ListItem, CustomView etc.
Let’s proceed more with keyword extraction functionality:
   We have the object “Keyword”. We need to extract keyword from a text. So, what actually we
   need to?
   We need to develop a service that will take text as input and will provide keywords as output.
   This service will be used by our application and may also be used by many other applications.

   Developing the keyword extractor as a service rather than a function of your application
   exposes other design concerns too. This is natural that when you develop for your own, you
   may compromise many things. But as you are developing a service, you have to focus on
   extensibility, scalability and manageability.

   When you expose a service, you must ensure any change in your service will not affect the
   existing users of the service. 
   You see it is deriving you in enforcing good design principles in your development. Thus
   developing services can bring good practices in your code.
Now, let’s talk a little bit on Article Search on Keyword.

   We have already identified “Article” as a domain object of our application. Now we need to
   implement the search feature on it.

   Before jump into this imagine, someday, your article website becomes very popular.
   Different 3rd parties want to develop widgets to show contents from your website. They also
   want to provide search on keyword functionality in that widget. They are contracting with
   you to know how they can achieve that.

   Alas! If you do not follow proper design principle it is a nightmare for you.

   But think if you had developed the keyword search with good design principle and make the
   functionality as an article search service rather than a feature of your app, you already have
   what others are looking for.
• SOA
  So, we have decided, among the 3 functionality that we singlified from our requirement, we
  will develop 2 of those as service. Here is how Service Oriented Architecture (SOA) comes
  (More discussion on SOA is out of scope of this presentation). Look
  http://en.wikipedia.org/wiki/Service-oriented_architecture for more.

  So, so far for keyword extraction and article search we are approaching following 3 priciples:

  1. OOP
  2. DDD
  3. SOA
• Let’s go more in-depth of the implementation of Keyword extraction
  service.
   When you start developing keyword extraction service what are the questions
   comes to your mind?
• Questions:
   1. What is the algorithm/logic of extracting keyword from the text?
   Possible ans: Split by space, use third party keyword extrator, use other algorithm
   2. How will be the format of the output of the service?
   Possible ans: XML, JSON, other format
   3. What are the extensibility points for the service?
   Possible Ans: Note the possible answer of the above 2 questions. Both has an option called
      “Other”. So, this “other algorithm” or “other format” may not be defiend now, but it
      may come in future to get implemented.

      So, we will need to develop the service in a manner so, that it is extensible in future
      without affecting its clients.
So we can see in keyword extraction service, we have at-least 2 extension point.
1. The process of keyword extraction.
2. The process of keyword formatting.

Can you derive to the interfaces that you need here?
we can have 2 interfaces here

1. IKeywordExtractionService
     1. Method: GetExtractedKeywords
2. IKeywordFormatter
     1. Method: GetFormattedTags

     Now how will this 2 interface work together? You want extracted tags handling the format that your
        specific service returns with your desired formation.


     Any design pattern in your mind?
Here is my answer. There could be other answers too:

We may utilize “Strategy” pattern here.

The definition of the GetExtractedTags method of IKeywordExtractionService will be as follows:
     string GetExtractedTags(string queryText,ITagFormatter tagFormatter);

You will implement IKeywordExtractionService for different ways of extraction of the keywords.

Example: YahooKeywordExtractionService, AlchemyKeywordExtractionService,
    PantheonKeywordExtractionService etc.

In those implementations you will call

tagFormatter. GetFormattedTags(tags) so that you get the tags in your desired format.

    Now, from the client app you just get the correct instance of the service according to your desire
    and pass the correct formatter you will get your desired output.
You see the extension points are open in the pattern of implementation.
Anytime you can implement a different extraction process and also a
different formatter.
I hope, this session will help all of us to develop the sense of finding the objects from
 our spec, finding domain, differentiating domain objects with value objects, service
       oriented development and above everything object oriented approach.



• THANKS
• QUESTIONS?

Más contenido relacionado

Similar a Software Requirement Analysis and Thinking Process towards a good Architecture

Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by CitytechRitwik Das
 
Domain Driven Design in the Browser - Cameron Edwards
Domain Driven Design in the Browser - Cameron EdwardsDomain Driven Design in the Browser - Cameron Edwards
Domain Driven Design in the Browser - Cameron EdwardsHakka Labs
 
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleIntroduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleSandeep Hijam
 
Automatic reference counting (arc) and memory management in swift
Automatic reference counting (arc) and memory management in swiftAutomatic reference counting (arc) and memory management in swift
Automatic reference counting (arc) and memory management in swiftInnovationM
 
2020 Top Web Development Trends
2020 Top Web Development Trends2020 Top Web Development Trends
2020 Top Web Development TrendsPencil Agency
 
Cis 555 Week 4 Assignment 2 Automated Teller Machine (Atm)...
Cis 555 Week 4 Assignment 2 Automated Teller Machine (Atm)...Cis 555 Week 4 Assignment 2 Automated Teller Machine (Atm)...
Cis 555 Week 4 Assignment 2 Automated Teller Machine (Atm)...Karen Thompson
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperFabrit Global
 
Learn reactjs, how to code with example and general understanding thinkwik
Learn reactjs, how to code with example and general understanding   thinkwikLearn reactjs, how to code with example and general understanding   thinkwik
Learn reactjs, how to code with example and general understanding thinkwikHetaxi patel
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web ApplicationMichael Choi
 
Rhok 101 for change makers - with an agile flavour
Rhok 101 for change makers - with an agile flavourRhok 101 for change makers - with an agile flavour
Rhok 101 for change makers - with an agile flavourCaoilte Dunne
 
SharePoint Apps for the End User
SharePoint Apps for the End UserSharePoint Apps for the End User
SharePoint Apps for the End UserRegroove
 

Similar a Software Requirement Analysis and Thinking Process towards a good Architecture (20)

Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
Domain Driven Design in the Browser - Cameron Edwards
Domain Driven Design in the Browser - Cameron EdwardsDomain Driven Design in the Browser - Cameron Edwards
Domain Driven Design in the Browser - Cameron Edwards
 
Python Homework Help
Python Homework HelpPython Homework Help
Python Homework Help
 
Fs1
Fs1Fs1
Fs1
 
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning SimpleIntroduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning Simple
 
A plumber's guide to SaaS
A plumber's guide to SaaSA plumber's guide to SaaS
A plumber's guide to SaaS
 
Go With The Flow
Go With The FlowGo With The Flow
Go With The Flow
 
React projects for beginners
React projects for beginnersReact projects for beginners
React projects for beginners
 
Automatic reference counting (arc) and memory management in swift
Automatic reference counting (arc) and memory management in swiftAutomatic reference counting (arc) and memory management in swift
Automatic reference counting (arc) and memory management in swift
 
2020 Top Web Development Trends
2020 Top Web Development Trends2020 Top Web Development Trends
2020 Top Web Development Trends
 
Cis 555 Week 4 Assignment 2 Automated Teller Machine (Atm)...
Cis 555 Week 4 Assignment 2 Automated Teller Machine (Atm)...Cis 555 Week 4 Assignment 2 Automated Teller Machine (Atm)...
Cis 555 Week 4 Assignment 2 Automated Teller Machine (Atm)...
 
Angular
AngularAngular
Angular
 
C++ & VISUAL C++
C++ & VISUAL C++ C++ & VISUAL C++
C++ & VISUAL C++
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
 
Learn reactjs, how to code with example and general understanding thinkwik
Learn reactjs, how to code with example and general understanding   thinkwikLearn reactjs, how to code with example and general understanding   thinkwik
Learn reactjs, how to code with example and general understanding thinkwik
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web Application
 
Rhok 101 for change makers - with an agile flavour
Rhok 101 for change makers - with an agile flavourRhok 101 for change makers - with an agile flavour
Rhok 101 for change makers - with an agile flavour
 
Sp apps for the end user 2013-08-15
Sp apps for the end user 2013-08-15Sp apps for the end user 2013-08-15
Sp apps for the end user 2013-08-15
 
SharePoint Apps for the End User
SharePoint Apps for the End UserSharePoint Apps for the End User
SharePoint Apps for the End User
 

Último

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Último (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Software Requirement Analysis and Thinking Process towards a good Architecture

  • 1. Think Again Before You Start Coding! Thinking Process! Mahmud Hasan Software Engineer Bangladesh
  • 2. What we actually do in everyday programming? We basically do just 3 things in all the applications. 1. We take input 2. We process input 3. And we generate output If we narrow it down more, we basically work with a single goal. That is “We want to generate output” from our application. Now, think what the word “Output” actually means? Simple – “Showing Object!” Example? 1. In database applications we generate views and reports. 2. In games we show different characters of the game and show change in their view based on scenario and action. 3. In console apps we save, we trigger but ultimately we do something that would be viewable somewhere.
  • 3. Now A requirement comes to you and let’s walk through how we can proceed in implementing the requirement. • 1st of all you need to break down the requirement in single piece of functionalities. Note that I have bold out the word “Single”. Yes, you never implement more than one functionality at a time. • After breaking down the functionality in single units the next question you will ask yourself for each and every functionality is, what are the items that you will need to deal with in that specific functionality? The answer of this question is/are your object/s.
  • 4. Example: • Requirement (From our real life project): Extract keywords from articles and save those in your database. Implement search on article based on the extracted keywords. Breakdown: 1. Extract keywords from article. Objects: Keyword, article. 2. Save keywords to database. Objects: Keyword. 3. Search article on keywords. Objects: keyword, article. (Do you see any other object here? Will come to this point later.)
  • 5. Context of the functionality • Next question you will ask yourself is, what is the context of the functionality you are going to implement? • Does the object/s of the functionality closely related with the specific Domain of your application? Mark that, I have bold out the word “Domain” • Does the object/s of the functionality can be co-related with a broader domain? • So, what actually you mean by the word “Domain” in software engineering? We all know that, an application is basically composed of several functionalities where we deal with different objects. So, we have 2 things here: One is objects and another is functions around those objects. If you think from narrow sense, your application is a closed system where you implement different functions to deal with different objects. From this context, the application will have only one kind of user: Users who gets into the application and use it.
  • 6. Think Broad: If you think with a little broader sense, your application might have 2 type of users: 1. Users who gets into the app and use it. You are initially develop the app for them. 2. Users who may like to use data that you are preserving in your application. This scenario may come later. So, if the second scenario comes you will need to expose your objects and functionalities to the external world. Here the concept DDD and SOA comes along with OOP. (Will come to this point later.) Example: Think of FaceBook. it has many information on its members and their friends. But is it a closed system? No. It has exposed it’s objects to the external world and so you can find lot of exciting apps on facebook by many developers. Think of the facebook app on your windows phone. 
  • 7. • Let’s come back to the question what actually the word “Domain” means. Domain is actually the specific area/ topic/ business that your application is going to be developed for. Remember the question you asked yourself earlier? So, The context of the functionality can be your own application domain. Or, it can be a broader domain where applications of other domains may also us this. So, it seems your object indeed has a domain and applications, including your one, of the same domain may use your object for different purposes. And that is how you can call your objects as Domain objects.
  • 8. Note that, we have not thought of any database or table in analyzing the requirement. Rather, we still are finding and analyzing the objects for the requirement. For our specific requirement we found 2 objects: One is “Keyword” that will be extracted from articles. And the other one is “Artcicle”. It is obvious that the keyword extraction feature is a requirement of your application. But If you ask yourself that if the keyword extraction feature can be useful from other applications of different domain? Yes it can be. If we think of this feature is just extracting keywords from a large text, it might be useful from many other apps. So, this function is not your application domain specific. Thus the object “Keyword” can be considered as an object, but of a separate domain than your application. The domain can be “Text” or something more generic!
  • 9. “Keyword” is basically a value object of the extraction service. Now, the question is what is value object? A value object of any domain or application is the object that do not have its own identity. In other words that does not get saved in any repository. When keyword is returned from the extraction service, it is a value object for that service. Now, when you have received the keywords in your application the next functionality you will need to implement is saving the keywords. This time the keyword is a domain object for your application domain.
  • 10. DDD Now come to the object “article”. This is the object that is specific to your domain where you play around different articles. So, it is a domain object for your application and the external world that will deal with your domain. So, up to this point, we have found out 2 domain objects and 1 value object out of our requirement. And still not thinking of database table or storage. In-fact we are approaching in Domain Driven Design (DDD) approach. (More detail of DDD is not in scope of this presentation. See more on this here http://en.wikipedia.org/wiki/Domain- driven_design) Gradually your domain objects will lead you to the database and you can easily have your database from this approach using EF 4.0 code first approach. (This is not focus of this presentation.) More Example of Domain Object: Customer, Supplier, Book, Library, Measure, Portfolio etc. More Example of Value Object: SearchCriteria, ListItem, CustomView etc.
  • 11. Let’s proceed more with keyword extraction functionality: We have the object “Keyword”. We need to extract keyword from a text. So, what actually we need to? We need to develop a service that will take text as input and will provide keywords as output. This service will be used by our application and may also be used by many other applications. Developing the keyword extractor as a service rather than a function of your application exposes other design concerns too. This is natural that when you develop for your own, you may compromise many things. But as you are developing a service, you have to focus on extensibility, scalability and manageability. When you expose a service, you must ensure any change in your service will not affect the existing users of the service.  You see it is deriving you in enforcing good design principles in your development. Thus developing services can bring good practices in your code.
  • 12. Now, let’s talk a little bit on Article Search on Keyword. We have already identified “Article” as a domain object of our application. Now we need to implement the search feature on it. Before jump into this imagine, someday, your article website becomes very popular. Different 3rd parties want to develop widgets to show contents from your website. They also want to provide search on keyword functionality in that widget. They are contracting with you to know how they can achieve that. Alas! If you do not follow proper design principle it is a nightmare for you. But think if you had developed the keyword search with good design principle and make the functionality as an article search service rather than a feature of your app, you already have what others are looking for.
  • 13. • SOA So, we have decided, among the 3 functionality that we singlified from our requirement, we will develop 2 of those as service. Here is how Service Oriented Architecture (SOA) comes (More discussion on SOA is out of scope of this presentation). Look http://en.wikipedia.org/wiki/Service-oriented_architecture for more. So, so far for keyword extraction and article search we are approaching following 3 priciples: 1. OOP 2. DDD 3. SOA
  • 14. • Let’s go more in-depth of the implementation of Keyword extraction service. When you start developing keyword extraction service what are the questions comes to your mind?
  • 15. • Questions: 1. What is the algorithm/logic of extracting keyword from the text? Possible ans: Split by space, use third party keyword extrator, use other algorithm 2. How will be the format of the output of the service? Possible ans: XML, JSON, other format 3. What are the extensibility points for the service? Possible Ans: Note the possible answer of the above 2 questions. Both has an option called “Other”. So, this “other algorithm” or “other format” may not be defiend now, but it may come in future to get implemented. So, we will need to develop the service in a manner so, that it is extensible in future without affecting its clients.
  • 16. So we can see in keyword extraction service, we have at-least 2 extension point. 1. The process of keyword extraction. 2. The process of keyword formatting. Can you derive to the interfaces that you need here?
  • 17. we can have 2 interfaces here 1. IKeywordExtractionService 1. Method: GetExtractedKeywords 2. IKeywordFormatter 1. Method: GetFormattedTags Now how will this 2 interface work together? You want extracted tags handling the format that your specific service returns with your desired formation. Any design pattern in your mind?
  • 18. Here is my answer. There could be other answers too: We may utilize “Strategy” pattern here. The definition of the GetExtractedTags method of IKeywordExtractionService will be as follows: string GetExtractedTags(string queryText,ITagFormatter tagFormatter); You will implement IKeywordExtractionService for different ways of extraction of the keywords. Example: YahooKeywordExtractionService, AlchemyKeywordExtractionService, PantheonKeywordExtractionService etc. In those implementations you will call tagFormatter. GetFormattedTags(tags) so that you get the tags in your desired format. Now, from the client app you just get the correct instance of the service according to your desire and pass the correct formatter you will get your desired output.
  • 19. You see the extension points are open in the pattern of implementation. Anytime you can implement a different extraction process and also a different formatter.
  • 20. I hope, this session will help all of us to develop the sense of finding the objects from our spec, finding domain, differentiating domain objects with value objects, service oriented development and above everything object oriented approach. • THANKS • QUESTIONS?