Skip to main content
Engineering LibreTexts

2.1.5: Computer Science

  • Page ID
    113893
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Summary

    Modular design is important for software developers to consider when designing software.  Modular design is often emphasized when writing code.  Different methods and object classes can be used to make software modular.  If a class or method needs to be updated or fixed, it can be changed with minimal changes to the rest of your code.  Modular design can also refer to the end-user experience.  Modular software can include the integration of external bots and tools, which can serve to enhance the end-user experience.  

    Because of its many benefits, modular design is important for anyone writing code. It can significantly improve software's front-end functionality while enabling smooth back-end maintenance.  

    Practical Examples

    Modular Code

    Coding can often be simplified by taking a modular approach. When coding with modules, you aim to create small, self-contained methods acting as modules. It is unnecessary to fully understand what other modules in the code do when writing each individual module. This approach enables large groups of people to work together and complete complex projects more quickly (1). For example, separate teams can be assigned to design the user interface, handle mathematical operations, and implement web functionality in an online software system (2).

    Coding with modules also makes it easier to find bugs. Since modules are isolated, tracking the inputs and outputs of a function becomes more straightforward, allowing developers to find and fix bugs faster (1).

    Traditionally, modules consist of two parts: the interface and the implementation. The interface allows communication between modules, including both calling and being called by other modules. It also includes comments describing the constraints of the program, which warn other developers about potential issues. The implementation is the body of functional code. Developers can change the implementation without modifying the interface, thus altering the module’s behavior without disrupting its interactions with other modules (3).

    Despite its many advantages, modular code can become complex and difficult to manage, especially as systems grow. As code becomes more intricate, it can be challenging for developers to trace the functionality of individual modules (1). Therefore, it is crucial for software developers to take extra time to create thorough documentation when developing modular programs, allowing others to contribute effectively.

    Discord API

    Discord is a popular platform used to create online communities. One of its key features is built-in bot functionality. Bots are software tools that moderators can add to chatrooms to perform various tasks, such as moderating messages, playing music, or notifying users about updates. These bots are developed by third-party developers and can be free, require a one-time purchase, or operate on a subscription model (4).

    Discord allows users to create custom bots through an open-source API (documentation found [here]). This API enables users to program bots in languages such as Python, providing the flexibility to create bots tailored to specific needs, such as user onboarding or automated moderation (5).

    Bots are also modular within servers, meaning they can be easily swapped out by moderators. If a bot malfunctions or its functionality changes unfavorably, moderators can quickly replace it with another bot that serves the same purpose. A notable example is the mee6 bot, which handled custom welcome messages and moderation. When its price increased to $12 per month per server, many small communities found it too costly. As a result, many moderators switched to the Carl bot, which offers similar functionality for free (6).

    When designing software, it's essential to consider modularity not only in the backend but also in the front end. Modular design can significantly enhance the user experience by providing customization options, allowing users to tailor programs to their specific needs.

    discord.jpeg

    Figure 3.3.6.1 The discord app is available on mobile devices.

    References 

    (1)  Brenkus, J.; Fausnaugh, A.; Welton, K.; Prof, A.; David, G.; Aloi. The Advantages of Modular Design in Software Engineering. https://www.csuohio.edu/sites/defaul...ngineering.pdf.

    (2)  Archiveddocs. Modularity. learn.microsoft.com. https://learn.microsoft.com/en-us/pr...ectedfrom=MSDN.

    (3)  Modular Design. web.stanford.edu. https://web.stanford.edu/~ouster/cgi...=modularDesign.

    (4)  What Is A Discord Bot, Some Examples And Some Tips To Do The Best. Xenioo. https://www.xenioo.com/whats-is-a-discord-bot/.

    (5)  IONOS editorial team. How to make a Discord bot. IONOS Digital Guide. https://www.ionos.com/digitalguide/s...g-discord-bot/.

    (6)  Roonie. Why People Hate MEE6? (Better Alternatives) - Netcord Articles - Medium. Medium. https://medium.com/netcord/why-peopl...s-733fae94217e (accessed 2024-10-27).


    2.1.5: Computer Science is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?