7 comments

  1. Better yet, you can save your own class files and projects as templates!

    With the C# IDE extensions in VS 2005 enabled you will have a ‘Save as Template’ function in the file menu. This will create a zipfile which you can deploy to all the dev-stations in the project.

    bartg

  2. Why would you want the default to be public? The defaults were not chosen at random!! They force you to think twice before increasing the visibility.

    By default a class without an access specifier is internal and a member defaults to private. This it keeps the visibility as restricted as possible and thereby increases encapsulation.

    Making a new class public without even thinking about breaks the entire idea of encapsulation.

    frankb

  3. I am with Frank on this one. I love having most classs internal, by separating code in projects you really need to think about what gets to be public

    Wouter

  4. To level out the discussion: I’d prefer not using the default as things should be explicit and I agree with Frank: things should be as hidden as possible.

    ernow

  5. So my tendency to remove the private keyword for methods and fields will probably not suite you.. ? 🙂

    I am a minimalist (also called lazy in some countries)

    wouterv

  6. In programming lazyness is a generally a good thing. As stated before; the defaults were not choosen at random. These are the options you usually want unless you explictly choose something else.

    When I start Word it automaticaly opens a default template (Letter.dot) because that is the one I use most of the time. I don’t want to explicitly choose that template every time!

    frankb

  7. I agree with you guys that one should keep the visibility as restricted as possible. But too often I have to modify the modifier. This is probably due to the kind of software we create for Endeavour. A great part of the software is framework stuff and keeping most things internal doesn´t make a framework very usable 🙂 Every time I create a class I still ask myself what visibility it should have up front.

    Patrick Gilhuijs

Comments are closed.