---
title: "Custom Attributes are goodness"
url: "https://osherove.com/blog/2003/3/9/custom-attributes-are-goodness.md"
canonical: "https://osherove.com/blog/2003/3/9/custom-attributes-are-goodness.html"
published: "2003-03-09T13:46:00"
updated: "2003-03-09T13:46:00"
tags: []
author: "Roy Osherove"
description: "Well, Iv'e been generating some code for a nice little project ive been working on, and one of the features of the product (I hope to talk about this in a future post) is that it allows plugins to generate custom trace…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Custom Attributes are goodness

By Roy Osherove March 9, 2003

**Historical article** · Originally published March 9, 2003; technical details may be outdated.

Well, Iv'e been generating some code for a nice little project ive been working on, and one of the features of the product (I hope to talk about this in a future post) is that it allows plugins to generate custom trace messages to be used in a client.

The client uses and processes the trace messages using reflection (i.e Each message can have totally different properties, and it's up to the client to handle the changes).  I wanted to allow the plugin creator to mark some or all of the public properties of a message as invisible. So i went ahead and created a "VisiblePropertyAttribute"  class, which marks if a field should be explicitly processed by the client. The client then recieves the message object and uses Type.GetCustomAttributes() to loop though all the attributes on a property and check whether it needs processing.

What can i say. I love this. this is soo elegant. I wonder if there is  such a feature in other languages.


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
