Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As far as programming languages go, I love C#, and for that matter all the good that comes from the .net framework (LINQ, etc).

My main concern is I seem to be churning out too much code, and using OOP, I have a concern my code isn't always that easy to manage.

I want to continue using C# and .Net, but are there any other approaches to applying the language to get overall less code, and easier to manage compared to text book OOP?

Thanks in advance!

share|improve this question

migrated from stackoverflow.com Aug 9 '11 at 13:49

This question came from our site for professional and enthusiast programmers.

5 Answers 5

up vote 11 down vote accepted

Yes - I've found the same problem. OOP isn't the best way to solve all problems. However, C# supports the functional paradigm quite well and I've used it successfully on a few projects now.

There is an interesting talk here with respect to simplification which should give you some food for thought at least: http://skillsmatter.com/podcast/design-architecture/simple-is-better

share|improve this answer

If you're willing to experiment try AOP / C# like here and here. the PDF has a fine sheet on pros and cons.

share|improve this answer

Aspect Oriented Programming may allow you to gain some efficiency by handling your "crosscutting concerns" in a uniform way. There are other possible benefits, but in my opinion it would be useful to you!

http://en.wikipedia.org/wiki/Aspect-oriented_programming http://www.sharpcrafters.com/aop.net

share|improve this answer

Before straying too far into differing methodologies, make sure to take advantage of refactoring to simplify and consolidate your code. Here is Fowler's catalog, the "alpha List of refactorings," each of which can help you improve and manage your C# code.

By learning to effectively design for reuse and by optimizing your application of interfaces, abstract classes, class hierarchies, dependency injection, and similar tools that exist within the standard object-orientated methodology, you may find yourself well on your way to achieving your desired results.

Beyond that, @Chris Smith has already pointed you to the fact that newer versions of C# (3.5 and 4.0) have added several functional programming capabilities that may help you make your code rock!

If you find you like functional programming, give Microsoft's new F# language a try! It's actually more like "object-functional," a mixture of the two methodologies. You may also want to know that you can mix F# and C# in the same .NET Solution.

I also concur with the other commentators that AOP certainly has its uses!

share|improve this answer

OOPS may have caused more code but If your application is large, the reduced complexity OOPS brings in would have resulted in maintainable,manageable code and clarity. If this is not the case and you feel it as a burden I am sure you might have used improperly. check if your classes are representing the domain objects properly and the communication among them is close to how it happens in the real world system that you try to simulate in program.

In C#, too much code is not a realistic reason to move away from OOPS IMHO. A paradigm shift should have a much more valid reason, in reality.

one can do 'structured programming' in C#..but I guess it will be a waste of time and effort.And most of the mainstream alternatives make use of OOPS too.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.