---
title: "Discussion on \"Code Smell 68 - Getters\" | Hashnode"
description: "Discussion on \"Code Smell 68 - Getters\". Getters and Setters are Code Smells.\n\nGetting things is widespread and safe. But it is a very bad practice."
url: "https://hashnode.com/posts/code-smell-68-getters/608a21651bb72c5818620985"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Code Smell 68 - Getters](https://maximilianocontieri.com/code-smell-68-getters?utm_source=hashnode&utm_medium=feed)

Getters and Setters are Code Smells. Getting things is widespread and safe. But it is a very bad practice.

Apr 29, 2021 · 1 min read · maximilianocontieri.com  
Read the article

-   [#code-smell-1](https://hashnode.com/tag/code-smell-1)
-   [#clean-code](https://hashnode.com/tag/clean-code)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)
-   [#programming](https://hashnode.com/tag/programming)
-   [#general-advice](https://hashnode.com/tag/general-advice)

## Written by

[Maxi Contieri](https://hashnode.com/@mcsee)

@mcsee · Buenos Aires

  
[View profile](https://hashnode.com/@mcsee)

Software Engineer

I’m a senior software engineer loving clean code, and declarative designs. S.O.L.I.D. and agile methodologies fan.

## Responses 2

Markdown supported · ⌘↵ to post

[Rodrigo](https://hashnode.com/@rodrigomd)

[Apr 30, 2021](https://hashnode.com/posts/code-smell-68-getters/608a21651bb72c5818620985/comment/608b6321f80abf020dc60c54)

Interesting article [Maxi Contieri](https://hashnode.com/@mcsee). If I get it right (see what I did there ) getters could be fine to be used if we assign a better name by removing the ¨get¨prefix and using a domain name instead. Another restriction is that we should use them only on safe operations, such as reading.

They become a problem when we expose the object internals to mutate its data from the outside, breaking encapsulation as consequence, is that right?
