Ayende @ Rahien

Hi!
My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 10 | Comments: 36

filter by tags archive

A code base has its own style

time to read 1 min | 104 words

Here is an observation, once a code base has reached a certain size, either in time or in size, it usually takes on a style and identity of its own. This is far more than just a coding style that I am talking about. I don't care where you put the braces. I am talking about the repeated patterns that you see over and over in side that code base.

An example would be Castle-inspired projects. You are far more likely to see things named SmartXYZ or IAbcAware, with the usual implications that there are there.

What are the styles that you have noticed?


Comments

Nate Kohari

My own code seems to always include type triplets: an interface (IService), the abstract base class (ServiceBase) and the standard implementation (StandardService). Interaction is based on the interface and inheritance is based on the abstract base class.

I don't necessarily like it -- the Base suffix in particular can be obnoxious. :) I just started doing it that way, and it stuck.

Scott Allen

I'm looking at code now with a string pattern - that's the worse.

i.e.

Session["magic"]

dataSet["magic"]

Cache["magic"]

Everywhere I look, I see string literals.

Francois Tanguay

Definitely,

We come up with conventions such as:

  • FindXYZ methods will return null while GetXYZ methods will throw.

  • TryXYZ will return bool and out value

  • All DTOs are suffixed with the Data keyword.

... and it goes on and on....

Surprisingly, those are never documented although they come through naturally by pairing...

Joe Ocampo

Favorite design pattern syndrome!

Seems the teams really groks one pattern and uses the hell out of it for everything! Not that this is a bad thing but it is funny to see how many XYZstrategy classes there are in the solution.

nichols.mike.s AT gmail.com (Mike Nichols)

I see alot of this in dealing with presentation problems such as patterns that have worked for deeply nested collections that are written to the view without letting the view have any significant code. For example, I am using Observer alot to stick inside a repeater to deal with collection item presentation from the presentation layer.

I always try to suffix the objects that either are employing a pattern or are parts of a bigger pattern with standard names for these so that I can know how to relate to it.

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

  1. Production postmortem: The case of the memory eater and high load - about one day from now
  2. Production postmortem: The case of the lying configuration file - 3 days from now
  3. Production postmortem: The industry at large - 4 days from now
  4. The insidious cost of allocations - 5 days from now
  5. Find the bug: The concurrent memory buster - 6 days from now

And 4 more posts are pending...

There are posts all the way to Sep 10, 2015

RECENT SERIES

  1. Find the bug (5):
    20 Apr 2011 - Why do I get a Null Reference Exception?
  2. Production postmortem (10):
    14 Aug 2015 - The case of the man in the middle
  3. What is new in RavenDB 3.5 (7):
    12 Aug 2015 - Monitoring support
  4. Career planning (6):
    24 Jul 2015 - The immortal choices aren't
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats