DEV Community

Cover image for Functionality & Maintainability: What's the Difference?
dev.to staff for The DEV Team

Posted on

Functionality & Maintainability: What's the Difference?

What distinguishes a code that simply "works" from one that is "maintainable and scalable"?


Follow the DEVteam for more discussions and online camaraderie!

Top comments (9)

Collapse
 
algorodev profile image
Alex Gonzalez • Edited

A code that simply works, is a code that do exactly what we want and we program it to do it without taking care of some principles that make our code more readable, more understandable...

A code that is maintainable and scalable, is a code that do exactly what we want, but we program it with best practices, trying to make it reusable, easy to read and understand. Why? Because some day we are going to add new functionalities or refactor the code and it needs to be easy to fix, easy to improve...

For example:

// Bad
let a = 10;
function f(x) {
    return x + a;
}
Enter fullscreen mode Exit fullscreen mode
// Good
let initialCount = 10;
function calculateFinalCount(currentCount) {
    return currentCount + initialCount;
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
renancferro profile image
Renan Ferro • Edited

Hey @algorodev

You can pass the code type in your block code and turn your code cool! As below:

Image description

Collapse
 
algorodev profile image
Alex Gonzalez

Edited, now it’s prettier! Thanks @renancferro for the tip!

Collapse
 
ssukhpinder profile image
Sukhpinder Singh • Edited

Lets understand with example

An application like calculator which does arithmetic operations that works as expected,

That's a functionality

Whereas, maintainability is when i add new features to the calculator, how easily it can be added with minimal damage like fixing existing bugs easily and less chances of introducing new ones.

Collapse
 
ludamillion profile image
Luke Inglis

I’m on of those engineers who was learning the ropes when it was en vogue to talk/write about things in terms of craft and craftsmanship.

While this isn’t always the best way of thinking about things it does give you some good metaphors to talk about things like this.

Think about a workshop. You have a lot of tools on your bench and need somewhere to store them. The desired functionality here is storing tools.

A box is functional. It does the job of storing your tools as well as anything else. But not particularly maintainable or scalable. If get more tools and need to store them what do you do? Get a bigger box? Another box? Also the UX of a box isn’t great either. Things aren’t sorted or particularly easy to retrieve.

Now a rack to hang tools from is better. Certainly more scalable. Need to store more tools? Add more hooks! Also more maintainable since it offers easier access and modification of its components. The points of failure tend to be much more atomic.

Collapse
 
prsaya profile image
Prasad Saya

Functionality is a requirement. Maintainability is a non-functional requirement.

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

"...a code..."? "...one that is..."? Did you proofread this?

Collapse
 
programcrafter profile image
ProgramCrafter

"a piece of code", if you'd like that more :-)

Collapse
 
ludamillion profile image
Luke Inglis

Not the most helpful comment.