|
-
Jun 27th, 2008, 02:30 AM
#1
Thread Starter
Evil Genius
Application design related question
Background:
I'm just writing a small home project at the mo, which contains the following classes:
- Windows form for input and to call processing methods.
- SubtitleFile abstract base class
- SRTSubtitleFile class which inherits the above, but is specific to a *.srt subtitle file.
The project shows the form/UI allowing a subtitle file to be chosen. This form in turn instanciates the SRTSubtitleFile class and runs some of it's methods.
Question:
Though I don't really need to extend this any further, I wanted to do things properly. So I was wondering, could I have everyones thoughts on the best way to expose the formats/types of subtitle files I'm supporting here please?
Currently I have an open file dialog control and I'm setting it's filter property to a hardcoded string to limit the files to those with a *.srt extension, but I really wanted to move away from this hardcoded implementation.
Thoughts so far:
Below I've listed a few thoughts I've had, but perhaps there's a common practice for this idea? Thanks everyone!
- 1) To add an Enum to the form (downside: if moving the subtitle bits to their own project in the future, the file types aren't exposed by any of these classes)
- Exposing an enum of file types from the SubtitleFile abstract class (neater, but downside means remembering to maintain this file rather than just adding in a new class/classes representing the new subtitle format)
- Exposing a property from the SubtitleFile abstract class which (maybe through reflection) evaluates and presents a list of all inheriting class names or property values (it just doesn't seem good practice to expose this from the SubtitleFile abstract class to me).
- Creating a separate SupportedSubtitleFormats class, and performing the evaluation and exposal of the formats from the classes inheriting SubtitleFile (utilise the inheriting SubtitleFile classes, or use the next point)
- Creating a separate SupportedSubtitleFormats class, then creating separate SRTSubtitleFormat SUBSubtitleFormat etc. classes which expose the format name and filetypes (utilise the inheriting SubtitleFile classes, or use extra classes and split off the file type information)
At the moment I'm thinking the last one, and I guess trying to take a look at reflection to get the inheriting classes & their details which might be overkill. Then whether to expose these child SubtitleFileFormat classes via the related child subtitleFile classes. Any and all comments/ideas/thoughts/opinions/random suggestions are warmly welcomed! Thanks again.
-
Jun 27th, 2008, 03:33 AM
#2
Re: Application design related question
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 27th, 2008, 06:14 PM
#3
Re: Application design related question
If the whole point is to be able to alter the user interface depending on each different class that inherits from SubtitleFile, I would change the design so that SubtitleFile is a user control with the needed elements on it. Each different class that inherits from SubtitleFile will implement its own look and feel and the form would just need to show the control.
-
Jun 28th, 2008, 11:19 AM
#4
Re: Application design related question
I'd do #1 or #2. I wouldn't spend too much time dwelling over this issue because I don't want to end up with a configurable configuration configurating configurator by attempting to 'OOP' everything (from previous gen-dev discussions if you recall).
Just about any choice can be justified... so I'll justify #1 or #2 by saying that the enum allows me to enable or disable certain SRT files.
-
Jun 28th, 2008, 02:35 PM
#5
Thread Starter
Evil Genius
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|