Sign in
|
Join
|
Help
in
Current Tags
Jimmy Bogard
LosTechies
(Entire Site)
Home
Merchandise
Blogs
Downloads
The Lounge
Ads by The Lounge
This Blog
Home
Contact
Syndication
RSS
Atom
Comments RSS
Recent Posts
Strategies and discriminators in NHibernate
Parameter lists in NHibernate
Services in Domain-Driven Design
DDD, Repositories and ORMs
On good design and defining success
Tags
Agile
ALT.NET
altnetconf
ASP.NET
ASP.NET MVC
Austin Code Camp
Austin DDD Book Club
BDD
Behave#
Behavior-Driven Development
C#
Code smells
Continuous Integration
Design
Domain Driven Design
Domain-Driven Design
Entity Framework
Legacy Code
LINQ
LINQ to SQL
Misc
MonoRail
MSBuild
MVC
NBehave
NHibernate
PabloTV
Patterns
People
PTOM
Rails
Rant
Refactoring
SQL
StructureMap
TDD
Team Build
Testing
Tools
VSTS
WCF
News
Archives
August 2008
(10)
July 2008
(12)
June 2008
(11)
May 2008
(15)
April 2008
(10)
March 2008
(15)
February 2008
(13)
January 2008
(19)
December 2007
(9)
November 2007
(17)
October 2007
(23)
September 2007
(10)
August 2007
(11)
July 2007
(11)
June 2007
(9)
May 2007
(14)
April 2007
(7)
Jimmy Bogard
Assistant to the assistant to the regional manager
Browse by Tags
All Tags
»
C#
(
RSS
)
ASP.NET
Code smells
Domain Driven Design
Domain-Driven Design
Legacy Code
LINQ
MVC
Patterns
People
Refactoring
Testing
Deferred execution gotchas
I was trying to be clever the other day and try to chain assertions on an array: [ Test ] public void This_does_not_work() { var items = new [] {1, 2, 3, 4, 5}; items .Each(x => x.ShouldBeLessThan(0)) .Each(x => x.ShouldBeGreaterThan(10)); } I did...
Posted
Aug 13 2008, 08:08 AM
by
bogardj
with | with
3 comment(s)
Filed under:
C#
,
LINQ
Enumeration classes
A question came up on the ALT.NET message board asking whether Value Objects should be used across service boundaries. Of course, the conversation took several detours, eventually coming to the question, "what do you do about enumerations crossing...
Posted
Aug 12 2008, 08:05 AM
by
bogardj
with | with
29 comment(s)
Filed under:
Domain-Driven Design
,
C#
When a space isn't a space
I ran into a scenario recently where this test failed: [ Test ] public void You_have_to_be_kidding_me() { string a = "You have to be kidding me " ; string b = "You have to be kidding me " ; a.ShouldEqual(b); } It took me quite a while...
Posted
Jun 26 2008, 07:15 AM
by
bogardj
with | with
8 comment(s)
Filed under:
C#
Some improved LINQ operators
I ran across a couple of scenarios the other day that were made pretty difficult given the current LINQ query operators. First, I needed to see if an item existed in a collection. That's easy with the Contains method, when you want to find item that...
Posted
Jun 07 2008, 07:39 PM
by
bogardj
with | with
13 comment(s)
Filed under:
C#
,
LINQ
Forbidden Void type in C#
I've had this come up a couple of times. I'd really like to be able to do something like this: Func < bool , Void > whyNot = test => Console .WriteLine(test); This is equivalent to: Action < bool > okThisWorks = test => Console...
Posted
Jun 05 2008, 10:26 PM
by
bogardj
with | with
3 comment(s)
Filed under:
C#
LINQ query operators: lose that foreach already!
Now that .NET 3.5 is out with all its LINQ query operator goodness, I feel like going on a mean streak of trashing a lot of our (now) pointless foreach loops. Some example operations include: Transformations Aggregations Concatenations Filtering As I...
Posted
May 09 2008, 06:11 PM
by
bogardj
with | with
6 comment(s)
Filed under:
C#
,
LINQ
Enhancing mappers with LINQ
The "big 3" higher-order functions in functional programming are Filter, Map and Reduce. When looking at the new C# 3.0 LINQ query operators, we find that all three have equivalents : Filter = Where Map = Select Reduce = Aggregate Whenever you...
Posted
May 08 2008, 07:49 AM
by
bogardj
with | with
12 comment(s)
Filed under:
Domain-Driven Design
,
C#
,
LINQ
Stop creating custom delegate types
Note to OSS and framework developers: Please stop creating custom delegate types. Use the Action and Func delegates instead. The problem is that delegate types with the same signature are not convertible to each other. For example, none of these assignments...
Posted
Mar 26 2008, 10:03 AM
by
bogardj
with | with
17 comment(s)
Filed under:
C#
Variations on a Func-y theme
Delegates have come a long way since C# 1.0 debuted back in early 2002. The progression from using delegate parameters (outside of events) grew from quite cumbersome to fairly expressive with Lambda expressions with C# 3.0. Functional style programming...
Posted
Mar 22 2008, 01:15 PM
by
bogardj
with | with
4 comment(s)
Filed under:
C#
Last XML serializer I'll ever write
I've made this class probably a half dozen times, and I'm getting pretty tired of writing it. It seems like every application I write has to serialize and deserialize back and forth between XML strings and objects. For future reference, here it...
Posted
Feb 19 2008, 10:35 PM
by
bogardj
with | with
6 comment(s)
Filed under:
C#
Some C# obscurities
I'm sure everyone's tired of hearing about C# 3.0 features like lambda expressions, extension methods, anonymous types and so on. Before you fall in love with the new features, there are a few oldies-but-goodies that revolve around the "...
Posted
Jan 30 2008, 09:40 PM
by
bogardj
with | with
6 comment(s)
Filed under:
C#
Abusing using statements
I've always thought that the using statement was one of the most useful features included in C#. It's easy to use: public string GetFileTextForParsing( string path) { string contents = null ; using ( StreamReader reader = File .OpenText(path)...
Posted
Jan 15 2008, 11:04 PM
by
bogardj
with | with
7 comment(s)
Filed under:
C#
,
ASP.NET
,
MVC
Extension methods and primitive obsession
In another water-cooler argument today, a couple of coworkers didn't like my extension method example . One main problem is that it violates instance semantics, where you expect that a method call off an instance won't work if the instance is...
Posted
Dec 18 2007, 04:29 PM
by
bogardj
with | with
1 comment(s)
Filed under:
C#
,
Code smells
Ruby-style Array methods in C# 3.0
A while back I played with Ruby-style loops in C# 3.0 . This sparked my jealousy of other fun Ruby constructs that I couldn't find in C#, and a couple of them are the "each" and "each_with_index" methods for arrays. Here's...
Posted
Dec 14 2007, 04:12 PM
by
bogardj
with | with
2 comment(s)
Filed under:
C#
Hall of shame
We keep a "Hall of Shame" of WTF-level code snippets to remind us that however bad we might think things get, it could always be worse. It also serves as a reminder to us that we can't be complacent with ignorance, and lack of strong technical...
Posted
Nov 29 2007, 05:05 PM
by
bogardj
with | with
4 comment(s)
Filed under:
Legacy Code
,
C#
,
People
More Posts
Next page »
Copyright Los Techies 2007. All rights reserved.