Refactoring

Topics: Developer Forum
Developer
Apr 10, 2008 at 1:10 AM
There are few things in the existing codebase which I don't think are optimal. Among others:
- pinvoke definitions should be in one place
- the controls should have a prefix to distinguish them from standard Winforms controls (I'd like AeroButton vs. Button for example)
- some things could be done more designer friendly (GlassHelper should be turned into IExtenderProvider Component, which could be easily dropped on a plain vanilla Form)
- I noticed few violations of .NET naming guidelines (DWM instead of Dwm,...)

I won't make such large changes to the existing code. Instead, I'll make a new branch which could be then released as a version 2.0 (which wouldn't be backwards compatible, of course)... Any thoughts?
Developer
Apr 10, 2008 at 11:40 AM

- pinvoke definitions should be in one place

I completely agree, but I never had the time to refactor everything (I started putting everything in the "Native" subfolder, but didn't change all code). Go ahead if you want to. :)

- the controls should have a prefix to distinguish them from standard Winforms controls (I'd like AeroButton vs. Button for example)

I don't agree on this point: we already have the VistaControls namespace which uniquely identifies the controls. I'd leave the names as they are now. Marco should have the last word on this issue, anyway.

- some things could be done more designer friendly (GlassHelper should be turned into IExtenderProvider Component, which could be easily dropped on a plain vanilla Form)

I actually never heard of this IExtenderProvider, but it sounds great. Again, if you have the time to do it, go ahead! Actually, the Glass helpers classes should be refactored and put in an appropriate folder in "Dwm".

- I noticed few violations of .NET naming guidelines (DWM instead of Dwm,...)

Right. I will check in some code this afternoon or tomorrow and will correct the names.

Concerning backwards compatibility, this isn't actually an issue. I think that not being overly concerned of keeping compatibility between single releases leaves us more freedom to change and improve the code. All changes you listed will (hopefully) be in the next 1.4 release, which we thought could be release someday the next week or so.
Developer
Apr 10, 2008 at 1:48 PM
Lck wrote:


- the controls should have a prefix to distinguish them from standard Winforms controls (I'd like AeroButton vs. Button for example)

I don't agree on this point: we already have the VistaControls namespace which uniquely identifies the controls. I'd leave the names as they are now. Marco should have the last word on this issue, anyway.

The namespace is only one part to it. Someone might need to use both standard controls and ours. By using the same name, you force them to come up with their own aliases, which is plain ugly and very inconvenient. For example, SqlConnection is called System.Data.SqlClient.SqlConnection, not Connection, because somebody might happen to use more types of databases. Or in SharePoint, all types are prefixed with SP, because the names are very generic otherwise. (SPItem, SPFile, etc). PowerShell API is the same. And you could surely many other precedents.

I like the AeroButton, AeroForm, etc. it sounds nice, it's short, and conveys the information what one should expect from the control in question.
Developer
Apr 10, 2008 at 10:46 PM

jachymko wrote:
The namespace is only one part to it. Someone might need to use both standard controls and ours. By using the same name, you force them to come up with their own aliases, which is plain ugly and very inconvenient. For example, SqlConnection is called System.Data.SqlClient.SqlConnection, not Connection, because somebody might happen to use more types of databases. Or in SharePoint, all types are prefixed with SP, because the names are very generic otherwise. (SPItem, SPFile, etc). PowerShell API is the same. And you could surely many other precedents.

OK, that's convincing. ;)
I couldn't check in any code today because of connection problems but tomorrow I should be able to upload some minor addition and the naming changes (DWM to Dwm).
Coordinator
Apr 11, 2008 at 8:42 AM
Hi all!

I agree with the issues about pinvoke, IExtendedProvider and refactoring the code. For what concerns prefix control names, I think that is a good idea, but I don't like very much the prefix "Aero", because our controls work on Vista even if Aero is disabled. We could simply use the prefix "Vista", for example "VistaButton". What do you think?
Developer
Apr 11, 2008 at 9:11 AM
Edited Apr 11, 2008 at 9:11 AM
You can't disable Aero :-) You may disable Aero Glass, but you still get the shield icons, task dialogs and other stuff. Here's the description of what is called Aero: http://msdn2.microsoft.com/en-us/library/aa511291.aspx
Developer
Apr 28, 2008 at 10:01 AM
@jachymko: you are doing one hell of a job! Great work. ;)
I'm sorry I can't contribute right now (upcoming exams...), but I hope to be active again in a month or so... (and I'll need time to dig through all changes you are making)