views:

412

answers:

12
+13  Q: 

Patterns / Design

I do C# programming as a hobby mostly. This means I write certain amounts of code but lack the insight of other programmers, senior or not to provide insight into alternative, more useful or cleaner code patterns or habits. Even design of a library itself.

How do others deal with this situation to get decent code review? Some site? Making it open source? Some other manner?

A: 

Try refactormycode.com

missingfaktor
-1: Ugh! That site hurts my eyes!
Jim G.
@Jim : Wtf? Any sensible reason to downvote?
missingfaktor
@Rahul G: Given its *atrocious* interface, I have a hard time believing that *anybody* goes to that site on a regular basis.
Jim G.
@Jim: No reason to down vote. @Rahul: Some small text associated with the link would always help the OP and other people looking for answer.
KMan
@Jim : It's not my mistake that the looks of that site are so awful(Yes, I too agree on that). Despite that, the site is quite useful.
missingfaktor
@KMan : Will keep that in mind henceforth. Thanks for the constructive advice. :-)
missingfaktor
@Rahul G: It's my contention that the site looks *so* awful that it's unusuable. Therefore, I voted your answer as "not helpful".
Jim G.
+1  A: 

You may analyze some open source projects (for example, ASp.NET MVC) as examples of good architecture and coding.

Gopher
Good advice to learn by example, though OpenSource does not necessarily mean good architecture and coding. There are good ones and bad ones.
OregonGhost
+5  A: 

There are many ways to improve the design of your code and it depends on the type of learner you are.

By open sourcing your project you need to rely on it being interesting enough that it either is not a solved problem, or other are looking for a new approach to solving the problem. By having other people change your code or redesign you are learning by seeing.

Similarly using sites listed in the other answers you are learning by seeing. Another great site is http://www.dofactory.com/Patterns/Patterns.aspx. Reading books, forums like stackoverflow and blogs is the other way.

My personal recommendation is to try and find a mentor. The ability to ask the questions and get feedback in short time iterations is invaluable. Local user groups are a great place to start. The best alternative is a forum like stack overflow.

Oh and like anything practice. Code, refactor, learn, code, refactor

btlog
I agree. You don't have to expect anybody is even going to look at your code when you great an open source project. For the big popular open source frameworks yes, people will look at it, but your own little project, no, and even if they did, they wouldn't expect anyone to suggest an improvement.
Steven
+1 for the recommendation to try and find a mentor. You can never be sure that the mentor her/himself knows all the answers and best-practices, but she or he can probably point you in the right direction.
Anders Fjeldstad
A: 

Stop doing it as a hobby (and start doing it as a job). Because people who'd do code review as a hobby are no better at that than you are in coding.

ima
I do not know any programmer that does in his spare time program for hobby. The better programmers I do know all have a deeper knowledge because they dig into it in their spare time, not at work.
BeowulfOF
-1 just because someone does it as hobby does not mean they are bad. Conversely just because some does it full time does not mean they are good.
Matt Joslin
To quote the question: "This means I write certain amounts of code but lack the insight of other programmers, senior or not to provide insight into alternative, more useful or cleaner code patterns or habits.". And that's true. Feel free to down-vote though, I fully expect that.
ima
+2  A: 

I think the best way to improve is to code. Read books, solve problems and have fun.

Then every now and again, go and look at your old projects. Sometimes you'll admire the amount of effort you have put in because of your lack of experience at that time. Other times you'll actually be impressed.

Books are always a good idea!

dirk
-1: Going the strict autodidactic route has its limitations. I gave the same advice to a fellow over here: http://stackoverflow.com/questions/360542/plumber-programmers-vs-computer-scientists/360692#360692
Jim G.
+1 to balance that downvote.
missingfaktor
A: 

Lots of things.

I would say read articles about design patterns, look at the examples. Look at the functionality that you're developing from designs' perspective. And try use those designs. Study more about OOP, that would help you think in OOP way. DoFactory may be a good start.

For code reviews, download source of open libraries/projects/tools/etc; skim through the code. See project organization, code organization, naming conventions, etc.

Clearly, this would require a continuous "effort", since you "hobby" programming.

On a side note, in most cases that I have come across... hobby that turns into profession has higher chances of "excelling" in their career; probably because in that case you don't put much of an effort to convince yourself to learn about something, because you just start "being" that.

KMan
+1  A: 

A cycle of coding and reading books works for me. When I am tired of reading, I code. When I am tired of coding, I read.

  • Read it
  • Need it
  • Read it
  • Apply it

Every concept you put through this cycle will be forever stuck in your brain.

Sam
+4  A: 

As far as books go, I found "Head First Design Patterns" by Freeman (O'Reilly) to be a very easy to read intro to design patterns. The book's style takes some getting used to, though.
It assumes you already know an object-oriented language. A lot of people talk about the so-called Gang of Four (GoF) book; "Design Patterns: Elements of Reusable Object-Oriented Software" by Gamma, et al.

lundmark
If you can get with the Head First style I find a lot of them helpful (even though I would expect the style to have me tearing my eyes out!)
Aidan
When I first got the book I almost sent it back, I hated the style. It sat on the shelf for several months. I gave it a second chance and am glad I did because it is good. Now I'd buy other Head First books!
lundmark
+2  A: 

I think it really doesn't matter wether your doing it as a hobby or part of a professional team, self-improvement aka sharpening your sow is always a great thing.

You can achieve your goals simply by:

  1. Reading other peoples code - this can be from any source, I've learned alot from using re-sharper on the .net framework itself, open-source projects etc. remember to be proactive!
  2. Subscribing to people blogs, my recommendations, besides my own are
  3. CodeBetter.com
  4. A good way to reading this is just opening a blog posts of your interest and following all the links from there.. and so on.
  5. Another good tip is simply opening the wiki page on compute science and following the links from there.
MindFold
A: 

I think the best way is to read the books, publishing small controls and plugins to the web. So, there are lot of experienced developers out there will use your code and suggest modifications if needed. Have fun with learning.

Krishna
+2  A: 

You should take a look at the SO community wiki on code smells. Contains lots of good snippets and advice on little red flags in your code that can be fixed in a relatively short amount of time.

Ken
+1  A: 

In addition to GoF, Head First and doFactory, some useful samples not in c#, but other languages to give perspective. Java is similar enough to C# so you can read them.

http://www.fluffycat.com/Java-Design-Patterns/

http://www.vincehuston.org/dp/

http://www.holub.com/software/life/index.html (This book has a great reference in the back)

Patterns in the .net framework: http://msdn.microsoft.com/en-us/magazine/cc188707.aspx

Also google for individual patterns, for example: http://dotnet.org.za/reyn/archive/2004/07/07/2606.aspx

Any project that requires lots of repetition in creating objects will be a good candidate.

Also google for the opposite - there are a host of folks who have not good things to say about patterns, so you can see another perspective.

Steve
Adding one more source: http://sourcemaking.com/design_patterns
Steve