What I Learned About Functions Beyond Code Reuse
📰 Medium · Programming
Learn how functions can reduce cognitive load and improve code architecture beyond just code reuse
Action Steps
- Identify repeated code logic in your projects
- Wrap repeated logic into functions to avoid repetition
- Refactor functions to reduce cognitive load by making them more modular and reusable
- Apply functional programming principles to improve code architecture
- Test and iterate on your functions to ensure they are efficient and effective
Who Needs to Know This
Software engineers and developers can benefit from understanding the role of functions in reducing cognitive load and improving code architecture, making their code more maintainable and efficient
Key Insight
💡 Functions can simplify complex code and make it more maintainable by reducing cognitive load
Share This
Functions are not just for code reuse! They can also reduce cognitive load and improve code architecture #softwareengineering #coding
Key Takeaways
Learn how functions can reduce cognitive load and improve code architecture beyond just code reuse
Full Article
Title: What I Learned About Functions Beyond Code Reuse
URL Source: https://medium.com/@scosmexs/what-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f?source=rss------programming-5
Published Time: 2026-06-25T01:42:08Z
Markdown Content:
[Sitemap](https://medium.com/sitemap/sitemap.xml)
[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)
[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)
Get app
[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)
[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

# What I Learned About Functions Beyond Code Reuse
[](https://medium.com/@scosmexs?source=post_page---byline--84b7a5ae9a7f---------------------------------------)
[Sebastiao Cosme Agostinho](https://medium.com/@scosmexs?source=post_page---byline--84b7a5ae9a7f---------------------------------------)
Follow
2 min read
·
1 hour ago
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2F84b7a5ae9a7f&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&user=Sebastiao+Cosme+Agostinho&userId=012db5b4bbec&source=---header_actions--84b7a5ae9a7f---------------------clap_footer------------------)
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Frepost%2Fp%2F84b7a5ae9a7f&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&user=Sebastiao+Cosme+Agostinho&userId=012db5b4bbec&source=---header_actions--84b7a5ae9a7f---------------------repost_header------------------)
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2F84b7a5ae9a7f&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&source=---header_actions--84b7a5ae9a7f---------------------bookmark_footer------------------)
[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3D84b7a5ae9a7f&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&source=---header_actions--84b7a5ae9a7f---------------------post_audio_button------------------)
Share
## Moving from “avoiding repetition” to reducing cognitive load and architecture.
As I continue studying software engineering fundamentals, today’s lesson focused on one of the most common concepts in programming: **functions**.
At first, I saw functions mainly as a way to avoid repeating code. For example, if you have this logic:
Typescript:
const total = price * quantity;
const tax = total * 0.1;
const finalPrice = total + tax;
If that same logic is needed in multiple places, wrapping it inside a function makes total sense:
function calculateFinalPrice(pri
URL Source: https://medium.com/@scosmexs/what-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f?source=rss------programming-5
Published Time: 2026-06-25T01:42:08Z
Markdown Content:
[Sitemap](https://medium.com/sitemap/sitemap.xml)
[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)
[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)
Get app
[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)
[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

# What I Learned About Functions Beyond Code Reuse
[](https://medium.com/@scosmexs?source=post_page---byline--84b7a5ae9a7f---------------------------------------)
[Sebastiao Cosme Agostinho](https://medium.com/@scosmexs?source=post_page---byline--84b7a5ae9a7f---------------------------------------)
Follow
2 min read
·
1 hour ago
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2F84b7a5ae9a7f&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&user=Sebastiao+Cosme+Agostinho&userId=012db5b4bbec&source=---header_actions--84b7a5ae9a7f---------------------clap_footer------------------)
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Frepost%2Fp%2F84b7a5ae9a7f&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&user=Sebastiao+Cosme+Agostinho&userId=012db5b4bbec&source=---header_actions--84b7a5ae9a7f---------------------repost_header------------------)
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2F84b7a5ae9a7f&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&source=---header_actions--84b7a5ae9a7f---------------------bookmark_footer------------------)
[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3D84b7a5ae9a7f&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40scosmexs%2Fwhat-i-learned-about-functions-beyond-code-reuse-84b7a5ae9a7f&source=---header_actions--84b7a5ae9a7f---------------------post_audio_button------------------)
Share
## Moving from “avoiding repetition” to reducing cognitive load and architecture.
As I continue studying software engineering fundamentals, today’s lesson focused on one of the most common concepts in programming: **functions**.
At first, I saw functions mainly as a way to avoid repeating code. For example, if you have this logic:
Typescript:
const total = price * quantity;
const tax = total * 0.1;
const finalPrice = total + tax;
If that same logic is needed in multiple places, wrapping it inside a function makes total sense:
function calculateFinalPrice(pri
DeepCamp AI