Computer Science Canada

How much do you understand about organizing your code?

Author:  wtd [ Thu Apr 18, 2013 7:01 pm ]
Post subject:  How much do you understand about organizing your code?

Do you understand...

Functions?

Function composition?

Classes?

Modules/namespaces/packages?

How to build a program using multiple files?

Author:  Panphobia [ Thu Apr 18, 2013 8:41 pm ]
Post subject:  RE:How much do you understand about organizing your code?

So what kind of answer are you looking for? I understand functions, classes, and by function composition do you mean something like
code:
f(g(x))
I don't know what you mean by modules and namespaces, I do not think I completely understand packages, but I have an idea, and I think I know how to build a program using multiple files.

Author:  Nathan4102 [ Thu Apr 18, 2013 8:54 pm ]
Post subject:  RE:How much do you understand about organizing your code?

I can do functions and function composition, and I can build basic programs with multiple files. I've still got a lot to learn.

Author:  Insectoid [ Thu Apr 18, 2013 9:11 pm ]
Post subject:  RE:How much do you understand about organizing your code?

My code is either fairly well organized (disregarding namespaces, since my projects are never very large or intended for re-use) or a colossal mess. Both are intentional, just different objectives.

Author:  mirhagk [ Fri Apr 19, 2013 8:28 am ]
Post subject:  RE:How much do you understand about organizing your code?

I love nice clean code, that exposes beautiful interfaces to the rest of the code. I have grown to care less about squeezing that last 25% of performance out, and starting caring more and more about the code looking nice, and being easy to maintain.

Author:  Panphobia [ Fri Apr 19, 2013 9:18 am ]
Post subject:  RE:How much do you understand about organizing your code?

So then mirhagk do you support programming contests because they force you to get every last big of performance out of your Program, no matter how messy the code.

Author:  mirhagk [ Fri Apr 19, 2013 9:51 am ]
Post subject:  RE:How much do you understand about organizing your code?

Programming contests actually don't force you to get every last bit of performance. In fact most of my best solutions involve a lot of LINQ, which has overhead.

I'm not talking about not caring about performance at all, I'm talking about only caring about whether you're algorithm is O(n^2) or O(nlogn). I don't care if there is something that can speed it up 25%, because 25% is negligible (to get a 25% better computer costs very little compared to the hours spent squeezing that out). If there's something that can speed it up by a factor of 100, then obviously I'm all game, but coding nicely actually helps you gain those 100-fold performance gains, because it's easier to see what's going on, and easier to code. Coding nicely only sacrifices those 25% gains, but they aren't very useful anyways.

As for contest programming, most of my solutions actually end up looking nicer than a lot of other people's real code (like code they hand in for assignments). I use a lot of higher level features like LINQ, and lambdas which keep code clean while being very quick to code in. (Last year's first qualifier I sovled in about 3 minutes using a single line of code). Yes APIs aren't as nice as I'd ideally have, because I'm pressed for time, but good code organization helps you solve problems, it doesn't hinder it.

Author:  Cancer Sol [ Mon Apr 22, 2013 8:41 pm ]
Post subject:  RE:How much do you understand about organizing your code?

I still have a LONG way to go. I only know functions basically xD

I'm not really sure what you mean by function composition, but since I don't even know what you mean by that, then I probably don't know what it even is Razz


: