Comments (19)
What kind of things do you want to add? You can write extension methods for sealed classes.
Since there aren't any virtual methods (no real point), it doesn't make sense to make them subclassable.
I'd like to hear a valid reason for subclassing before I expend the work to make them subclassable.
from mimekit.
FWIW, this is a good article on the topic of sealing classes: http://blogs.msdn.com/b/ericlippert/archive/2004/01/22/61803.aspx
from mimekit.
I'm bringing it to your attention in this forum out of respect for you. Usually I go by SOLID principles; in this instance, open for extension, closed for modification. In this case, by derived class; which I am not modifying behavior, or if I did it would need to be conscious with a new keyword, at my own peril. I'll be blunt: if you don't want to do it, allow me as contributor and I'll do it.
My reason is simple: because I want to expose (at least) a couple of HeaderList details as properties, not as methods, or even as extension method syntactic-sugar. Debugging, etc, flows better when I can see the results as properties. Per se, I don't think Header needs to be extended, since HeaderList appears to be sole the "MessageHeader" concept.
Anyway, I did scan through the HeaderList class, and I'm not buying your excuse the level of effort it would take. Just remove the keyword; that is all. I'm not asking you to touch any of the code that works on or around the HeaderList. Nothing needs to be virtualized that I can tell, but could be if there's any question. I'm not asking you to change the List-of-Header-ness about the class, after all. What purpose would that serve, after all?
Worst case, you may need to reconsider what you are doing for the internal Dictionary, which you've got a duplication of code anyhow. List for Header ordering, and dictionary for easy lookup.
I've cobbled together a near term solution with a HeaderListAdapter which accepts a HeaderList in its ctor and which implicitly converts to and from HeaderList. That will work for now but would flow more smoothly if I could just "see" the adapter as a HeaderList.
from mimekit.
Okay I take that back; re: scope of impact, possibly need to consider things such as OnChanged ramifications. Possibly. I'll grant you that.
from mimekit.
Ya know, just an observation with the Changed event, pardon the pun:
internal event EventHandler<HeaderListChangedEventArgs> Changed;
You know there is an ObservableCollection, right?
from mimekit.
"Well, I might want to debug it and I like all my classes to be grab-bags of objects to make it easier for my style of debugging" isn't a really compelling argument for me.
If you want to write extension methods, just write extension methods. You don't need to subclass for that.
Anyway, thanks for the offer to write the patch but the amount of effort wasn't ever the problem. What I wanted was a good reason for needing to subclass those classes and you don't seem to have one.
If you find that you actually need to debug you HeaderList (I doubt you will), you can just modify your local copy of MimeKit (it's open source after all) and make whatever modifications you need to help you debug the problem.
Good API design principles suggest sealing classes that have no really good reason to be subclassable.
from mimekit.
Another reason is, there's no real good reason to hold common Header properties that close to the chest. But as you suggested, I can consider merging with a local code base.
from mimekit.
FWIW, you can't set the HeaderList on a message anyway, so there's really no point in subclassing it.
from mimekit.
BUZZ! I don't care about setting them. I want to get them. As properties.
from mimekit.
What good is subclassing a HeaderList if you can't actually set an instance on a message?
Give me an example.
from mimekit.
Like I said, I just want to get properties of a Header, as properties. Without necessarily loading the entire message. You'll just have to take my word for it, that's a requirement for this service.
from mimekit.
Professional critique: arguing this much with your customers, it's a wonder you keep business.
from mimekit.
This isn't a business, this is a personal side-project.
from mimekit.
I've unsealed a bunch of classes, including Header.
from mimekit.
I am available for contracting, though. My going rate is $400/hr.
from mimekit.
Professional praise: arguing this much with a parody account, it's a wonder you keep your calm.
Jeff, thank you so much for sharing the outstanding work you did on MailKit and MimeKit.
The quality and efficiency of your work is truly an inspiration.
from mimekit.
I totally agree.
Thank you for your great librarys.
from mimekit.
You're very welcome!
from mimekit.
It is indeed a fine library.
from mimekit.
Related Issues (20)
- Error using smtprelay server.com Port 25. HOT 1
- Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 HOT 1
- The PGP key server query builder omits leading zero(s) in 'keyId' parameter HOT 1
- Problem compiling tag 3.0.0 in x64 HOT 2
- Update BouncyCastle.Cryptography to 2.3.1 HOT 3
- PgpCore / MimeKit? HOT 2
- MimeKitLite not bumped to v4.6.0 on NuGet HOT 1
- SQLite is not available. Install the System.Data.SQLite nuget package. HOT 1
- Setting the attachment code is invalid HOT 12
- MimeKit is parsing address as `GroupAddress` instead of `MailboxAddress` HOT 2
- From returns blank when it contains special characters HOT 6
- Add an image as an in line signature HOT 3
- Mimekit 3.3+ Japanese CP encoding regression? HOT 1
- message/rfc822 attachment with blank Content-Transfer-Encoding header causes attachment to become corrupted when loaded and prepared by mimekit HOT 5
- ERROR: The type initializer for 'PerTypeValues1' threw an exception. HOT 3
- "|" and English cannot be correctly transcoded together HOT 5
- Message.Prepare adds '=\r\n' to last line if it doesn't end with a newline HOT 7
- Getting Exception Format Error with message: Failed to parse message headers HOT 3
- How do I decrypt attachments in S/MIME messages and save them
- MailKit crashes from headers in Korean HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mimekit.