Temporal Cohesion (Low Cohesion) - 4.2.5 | Course Module: Software Design Principles and Structured Analysis | Software Engineering Micro Specialization
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Academics
Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Professional Courses
Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skillsβ€”perfect for learners of all ages.

games

4.2.5 - Temporal Cohesion (Low Cohesion)

Practice

Interactive Audio Lesson

Listen to a student-teacher conversation explaining the topic in a relatable way.

Understanding Temporal Cohesion

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Today, we're diving into temporal cohesion, a defining aspect of low cohesion in module design. Can anyone share what they think cohesion refers to?

Student 1
Student 1

Isn't it about how related the functions within a module are?

Teacher
Teacher

Exactly! Cohesion assesses the relatedness of elements in a module. Temporal cohesion, specifically, groups functions executed at the same time. Why is this a concern?

Student 2
Student 2

Because the functions might not actually relate to each other logically!

Teacher
Teacher

"Right! Let’s remember the acronym 'TEMPORAL' to emphasize this:

Consequences of Temporal Cohesion

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Let’s explore the consequences of temporal cohesion. What are some challenges that arise?

Student 2
Student 2

Maybe changes to one function will affect others, and that can create bugs?

Teacher
Teacher

Absolutely! This is known as tight coupling. Modules with low cohesion are notoriously difficult to maintain. Can anybody think of ways to mitigate these issues?

Student 4
Student 4

I suppose breaking down the module by functions could help!

Teacher
Teacher

Exactly! We should strive for high cohesion instead, promoting modules that focus on a single task, much easier to maintain and reuse.

Student 1
Student 1

So maintaining that focus on cohesion matters?

Teacher
Teacher

Yes! Always remember, 'Single Responsibility' is key even if functions are grouped by time related to execution.

Student 3
Student 3

Do we commonly use temporal cohesion, or is that avoided?

Teacher
Teacher

While it may sometimes happen, we should actively work against it in favor of clearer, more functional groupings.

Student 2
Student 2

It's clear that clarity in purpose is important for effective software design.

Teacher
Teacher

Well said! Always aim for components in your modules that align closely with the intent of application, rather than mere timing.

Improving Module Design

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Now that we understand the downsides of temporal cohesion, let’s look at strategies to improve module design. Who wants to start?

Student 3
Student 3

We should always ensure each module has a single, clear responsibility!

Teacher
Teacher

Absolutely right! Each function aims at achieving a very specific target. Can we elaborate on how to break down tasks?

Student 1
Student 1

Maybe splitting larger modules into smaller functions that only do one thing?

Teacher
Teacher

Exactly! Striving for functional cohesionβ€”where everything works towards a common taskβ€”is the ideal we should pursue. Additionally, we need to understand that clear interfaces lead to better maintenance.

Student 2
Student 2

Are there any tools or principles we can follow to achieve this?

Teacher
Teacher

Definitely! The SOLID principles guide us towards better module design, especially focusing on the Single Responsibility Principle you mentioned earlier.

Student 4
Student 4

So, our goal should always be to understand both cohesion and coupling?

Teacher
Teacher

Yes! They are inversely relatedβ€”even as we pursue high cohesion, we naturally move towards lower coupling.

Student 3
Student 3

That makes complete sense! Thank you!

Teacher
Teacher

In summary, aim for high cohesion and keep a watchful eye on coupling for optimal and maintainable software design.

Introduction & Overview

Read a summary of the section's main ideas. Choose from Basic, Medium, or Detailed.

Quick Overview

Temporal cohesion groups module elements based on time-related execution, leading to low reusability and potential system fragility.

Standard

This section discusses temporal cohesion, defined as grouping module elements executed at the same time, regardless of their functional relationship. While it facilitates certain organization in code, it leads to low cohesion, making modules harder to reuse and understand due to potential impacts on unrelated functionality following changes.

Detailed

Temporal Cohesion (Low Cohesion)

Temporal cohesion is a type of low cohesion where elements within a module are grouped together because they are executed at the same time or during the same phase of execution, rather than due to functional relationships. This concept highlights the organizational structure within software modules, which aims for a degree of relatedness among functions based on their timing rather than their purpose.

Key Characteristics

  • Problematic Organization: Since functionalities are grouped by time rather than purpose, they can often be unrelated.
  • Example Module: A classic example is a module named StartupTasks() that might include operations like OpenLogFile(), InitializeAllVariables(), SetSystemClock(), and DisplayWelcomeMessage(). Although these functions are run during the startup phase, they do not share a functional link.
  • Issues with Temporal Cohesion: The consequences of this low cohesion level include:
  • Reusability Challenges: Specific parts of the module are hard to isolate for reuse in other contexts.
  • Tightly Coupled Dependencies: Changes in one part of the module might inadvertently impact unrelated parts, which affects maintainability and leads to potential bugs.
  • Reduced Understandability: Developers may find it challenging to understand the purpose of the module because the features do not work towards a common goal.

In summary, while temporal cohesion may facilitate handling certain operations simultaneously, it often degrades the quality of software design due to its lack of clarity and interrelated purpose.

Audio Book

Dive deep into the subject with an immersive audiobook experience.

Definition of Temporal Cohesion

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

The elements of the module are grouped together because they are all executed at the same time or within the same time window. They are related by time, not by function.

Detailed Explanation

Temporal cohesion refers to a situation where different parts of a module are brought together because they need to occur at the same time or within a specified timeframe. This does not mean that these parts perform similar tasks or belong to a common functional goal. The connection is purely based on timing rather than purpose.

Examples & Analogies

Imagine a morning routine where you wake up, brush your teeth, take a shower, and then eat breakfast. These activities happen in the morning and are often grouped together in your schedule, but they serve different purposes; they are not functionally related. This is similar to how functions in a temporally cohesive module behave.

Characteristics of Temporal Cohesion

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

The module performs a set of unrelated activities that logically should happen together at a particular point in time. Often associated with 'initialization' or 'cleanup' routines.

Detailed Explanation

Temporal cohesion usually involves activities that are distinct from one another but need to occur simultaneously, such as initialization tasks at the start of an application or cleanup tasks when shutting down. For example, when a software application starts, it might need to load configuration settings, open necessary files, and set the system clock, all of which happen at the same moment but do not contribute to a single, cohesive function.

Examples & Analogies

Consider a sports team preparing for a match. Before the game starts, the players might gather, do warm-up exercises, and discuss strategies. All these activities occur at the same time, but they focus on different aspects of preparation, like physical readiness and tactical planning, thus showing temporal cohesion.

Example of Temporal Cohesion

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

A module StartupTasks() that performs OpenLogFile(), InitializeAllVariables(), SetSystemClock(), DisplayWelcomeMessage(). These are all performed at startup but are otherwise unrelated.

Detailed Explanation

In the example of a module named StartupTasks, various tasks are executed. Each taskβ€”opening a log file, initializing variables, setting the clock, and displaying a welcome messageβ€”occurs at the startup of the program. However, these tasks do not interact or depend on one another; hence, the module lacks cohesion beyond timing. This can lead to confusion and reduced reusability since it's hard to extract a single function without dealing with the others.

Examples & Analogies

Think of a restaurant preparing to serve lunch. The staff may set the tables, prepare the ingredients, turn on the ovens, and print the menus all before opening. Though these tasks are synced with opening time, they serve different purposes and can be independent of each other. If the restaurant needed to adjust its opening time, it would have to run all those tasks again, illustrating the challenge of temporal cohesion.

Consequences of Temporal Cohesion

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

Hard to reuse a specific part, changes in one part might affect unrelated parts, harder to understand.

Detailed Explanation

The implications of temporal cohesion are significant. Since activities are merely grouped by their execution time, if one part needs revision, it may inadvertently impact other parts of the module that are unrelated. This system design can lead to increased difficulty in maintenance and reduce clarity, making it harder for developers to comprehend what each part is responsible for.

Examples & Analogies

Imagine a large vault where multiple teams practice their performances (like actors rehearsing a play). Each team is only there during the scheduled time, but if one rehearsal is delayed, it can disrupt the schedule for the others, even if their plays are completely different. This lack of interaction is analogous to how changes in a temporally cohesive software module can cause confusion and inefficiencies.

Definitions & Key Concepts

Learn essential terms and foundational ideas that form the basis of the topic.

Key Concepts

  • Temporal Cohesion: Grouping functions by time can reduce clarity and usability.

  • Low Cohesion: Impacts reusability, maintainability, and understanding.

  • Module Design: Focus on breaking down modules to promote functional cohesion.

Examples & Real-Life Applications

See how the concepts apply in real-world scenarios to understand their practical implications.

Examples

  • A module like StartupTasks() that combines unrelated functions performed at startup.

  • Two functions operating together in ScheduleJob() that update system logs and notify users, despite differing purposes.

Memory Aids

Use mnemonics, acronyms, or visual cues to help remember key information more easily.

🎡 Rhymes Time

  • If they flow together, yet don't relate, in temporal group they congregate.

πŸ“– Fascinating Stories

  • Imagine a person trying to make breakfast: they turn on the coffee machine, fry eggs, and toast bread at the same time, but these tasks are unrelated in function besides timing.

🧠 Other Memory Gems

  • Remember TEMPORAL: Timing, Execution, Multiple functions, Often unrelated, Reusability issues, Ambiguous, Low cohesion.

🎯 Super Acronyms

TEMP

  • Timed Execution of Multiple Processes.

Flash Cards

Review key concepts with flashcards.

Glossary of Terms

Review the Definitions for terms.

  • Term: Cohesion

    Definition:

    The degree to which elements in a module belong together or are focused on a single task.

  • Term: Temporal Cohesion

    Definition:

    Grouping of module elements based on their execution time rather than functionality.

  • Term: Coupling

    Definition:

    The degree of interdependence between software modules or components.

  • Term: Single Responsibility Principle

    Definition:

    A principle suggesting that a module should have only one reason to change, meaning it should have one primary responsibility.

  • Term: Functional Cohesion

    Definition:

    Highly desirable cohesion where all elements contribute to a single, well-defined function.