66366 members! Sign up to stay informed.

Sponsored Links


Resources

.NET Research Library
Get .NET related white papers, case studies and webcasts

.NET architecture .NET architecture .NET architecture Messages: 4 Messages: 4 Messages: 4 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

Partial classes

Posted by: peter lin on May 31, 2005 DIGG
I got an enhancement request from a user on Dingo's forum asking for Partial class support. Although implementing it isn't that hard, I question the value of Partial classes. So I have to ask others, "Is this feature really useful?" I found several articles and blogs discussion partial classes. One article on C# corner http://www.c-sharpcorner.com/Code/2004/July/WhidbeyFeatures.asp suggests Partial classes is good because it allows multiple developers to work on the same class. I find that idea scary and ripe for abuse. I then came across a blog by Dan Fernandez http://blogs.msdn.com/danielfe/archive/2004/02/02/66463.aspx suggesting it is a way to separate VS.NET generated code and user implemented code. although that reason seems valid to me, I think it would be better for VS.NET to generate an abstract class and label the necessary methods virtual. This way, users would extend that base class and implement the required methods.

What do others think?

peter

Threaded replies

·  Partial classes by peter lin on Tue May 31 15:20:34 EDT 2005
  ·  I totally agree by Daniel Melo on Wed Jun 01 12:02:14 EDT 2005
    ·  anyone know why partial was added to .NET 2.0? by peter lin on Wed Jun 01 13:21:14 EDT 2005
      ·  I disagree... by A Munk on Thu Jun 02 04:10:15 EDT 2005
  ·  I agree. Use refactoring by Faheem Sohail on Mon Jul 19 06:33:35 EDT 2010
  Message #172619 Post reply Post reply Post reply Go to top Go to top Go to top

I totally agree

Posted by: Daniel Melo on June 01, 2005 in response to Message #172449
Partial classes seem like a hack, made just to address the Visual Studio.NET issue.

I think that your suggestion of abstract classes would a lot better.

  Message #172630 Post reply Post reply Post reply Go to top Go to top Go to top

anyone know why partial was added to .NET 2.0?

Posted by: peter lin on June 01, 2005 in response to Message #172619
I'm curious as to why MS decided to provide Partial class in .NET 2.0? Was it to address the needs of VB developers? Is it some how related to the new modeling features in VS.NET? If there is a compelling reason, I'd like to know.

Even though it's tempting to dismiss the feature, I'd like to know the real reason and make sure I'm not just being totally bias.

peter

  Message #172719 Post reply Post reply Post reply Go to top Go to top Go to top

I disagree...

Posted by: A Munk on June 02, 2005 in response to Message #172630
It may seem that partial classes is a hack to support the new features in VS.NET 2005. At the same time I think that the purpose it serves in VS.NET is nice. Separate the designer code from the programmers code which is good. Especially in advanced projects.

Outside VS.NET I look forward to this feature as well. We use a codegenerator to generate all dataaccess classes and all classes that make up the state-objects. Today we have to inherit from the generated assembly to add additional methods. (And generate a new assembly) With .Net 2.0 we will be able to write the additional methods which will be compiled into the single output assembly. This will result in a much smooth build process.

Regards,
Anders

  Message #333500 Post reply Post reply Post reply Go to top Go to top Go to top

I agree. Use refactoring

Posted by: Faheem Sohail on July 19, 2010 in response to Message #172449
Partial classes are not object oriented. Use refactoring to spilt classes. http://thevoidmain.com/blog/?p=3

Recent active threads Recent active threads Recent active threads More More More
Exclude Sound While Converting FLV File to SWF Using Aspose.Flsh
Nextel i876 flip, Nextel i877 lcd flip
www.berrynextel.com i776 FLEX CABLE, i9 FLEX CABLE i877 FLEX
www.berrynextel.com Nextel I856 FLEX CABLE
Nextel i860 flex cable, i850 FLEX CABLE , i560 FLEX CABLE
www.berrynextel.com I580 FLIP, i570 FLIP, i576 FLIP, i776 FLIP
www.berrynextel.com Nextel i776w flips,Nextel i776 lcd flip
Nextel i877 lcd flip
More active threads »
Top posters of the weekTop posters of the weekTop posters of the week
This list contains the members who have made the most posts in all forums over the last 7 days:
  1. Karissa Sin
  2. sherazam khan
  3. Mike Liu
  4. Core Lab
Hot threads Hot threads Hot threads More hot threads More hot threads More hot threads

Eclipse vs. Visual Studio at EclipseCon 2006

Speaking at EclipseCon 2006, Java developer and independent consultant Madhu Siddalingaiah compared Microsoft's Visual Studio IDE to the open source development environment of Eclipse.
(33 comments, last posted March 09, 2010)

Tech Talk: Peter Provost on CAB and Agile development

In this tech talk, Microsoft's Peter Provost talks about the design of the Composite UI Application Block and how the p&p team has led Microsoft in the adoption of Agile methodologies.
(0 comments, last posted April 17, 2006)

Book excerpt: Framework Design Guidelines

Chapter 4 of Framework Design Guidelines, titled "Type Design Guidelines," presents patterns that describe when and how to design classes, constructs and interfaces. In this chapter, Abrams and Cwalina divide types into four groups and discuss the do's and don'ts of type design.
(2 comments, last posted July 07, 2006)

Q&A: Miguel "Mono Man" De Icaza

Paul Ferrill caught up with prime open-source .NET applications driver Miguel De Icaza at Novell's BrainShare conference last week. They discussed the status of Windows Forms for Mono (it's coming along) and VB.NET for Mono (it looks like it's out).
(5 comments, last posted March 30, 2006)

Tech Talk: Jack Greenfield on software factories and DSLs

In this tech talk, Microsoft Visual Studio architect Jack Greenfield discusses the company's approach to Domain-Specific Languages, or DSLs, and the part they play in software factories.
(0 comments, last posted March 15, 2006)
More hot threads »

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
All Content Copyright ©2007 TheServerSide Privacy Policy      Powered by JIVE
Site Map