Hey everyone, We haven't done a good contest here on DaniWeb for quite some time, so I'd like to start one up again :) Throughout the months of June and July, I'd like to encourage members to submit fully working code snippets to our library. Throughout the month of August,…
Or should we implement something with Python, C, C#, VB and Java, but then the snippets would get separate votes, not total of all versions.... Of course I would need still to learn C# (and improve Java/C/VB)...
pyTony
pyMod
6,299 posts since Apr 2010
Reputation Points: 879
Solved Threads: 984
Skill Endorsements: 26
To help with the problem of getting votes on less visited forums, I would suggest that, at least, all snippets should have a link posted on this thread, and ask that moderators try to take the time to check out each submission, even if it is in a foreign programming language (as in, not the mod's preferred language). I don't know about you, but I can appreciate a nice piece of code regardless of the programming language (as long as I understand it, which I do for most languages). But beyond that, as Dani said, it's part of the game, if you choose a narrow language to code a piece of code with a narrow application area, then you can't expect as much of a wide-spread appreciation of it.
Also, I'm starting to think of ideas and I'd like to get a feel for the expected extent of the snippet. So here are two ideas I have, tell me if they are too much or too little.
(1) A logging system for exceptions in C++, with some predefined logging and handling behaviors. With configurable sinks, strong safety guarantees, and so on.
(2) An adjacency-list graph overlaid on a breadth-first tree layout to allow for efficient, cache-aware (or cache-oblivious) binary-search tree implementations over nodes of a general graph (adj-list).
The first is pretty simple (~200 lines or so). The second is pretty hefty (~1000 lines or so) with loads of advanced C++ techniques. So, are code snippets expected to be closer to the former or the latter? Or am I completely crazy?
mike_2000_17
21st Century Viking
3,135 posts since Jul 2010
Reputation Points: 2,050
Solved Threads: 625
Skill Endorsements: 41
So, are code snippets expected to be closer to the former or the latter? Or am I completely crazy?
I don't think we're "expecting" one way or another, as long as the code snippet is, indeed, a self-contained snippet.
My mind is churning with regards to potential other awards we can give for snippets such as most useful ;)
Dani
The Queen of DaniWeb
21,342 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 367
Skill Endorsements: 119
I do not know, but maybe there should be encouraged to be considerable discussion in Code Snippets posted this summer commenting the strong points and interesting features of snippets as well as any blemishes. This could be used as less knowledgable members to gain insight of language they do not use and give them possibility to evaluate second hand through other's comments the snippets outside of their comfort zone.
I think in Python terms the upper limit of Code Snippet to be around 200-300 LOC. Main thing for me is that other members can crasp the whole code in their mind. Writing with more verbose/lower level languages could mean narrowing the scope of snippet. One possibility would be modular design with simple short basic implementation for some parts. Then you could present gradually improvements to those implementations. That would also make very interesting and relevant reading. Or you could have program with only basic functionality implemented and clear road for impovents. Even you could leave some obvious point unimplemented and point it out to encourage the readers to expand on your post. This my snippet could be example of this kind of left in middle, "open ended", (even at start) post: http://www.daniweb.com/software-development/python/code/403873/text-based-english-solitaire-from-wikipedia
This said I have posted many very short 'trick' or example of technique style of posts as code snippets, including one liners http://www.daniweb.com/software-development/python/code/382803/one-line-vigener-single-decryptencrypt-function-with-generator
I do not know how about people feel about these snippets, however. Have to get inspiration to post something, so I can find out through this competition. I have though shared so many ideas as I have posted until moment of writing this post 94 snippets, so I have not anything up in my sleeve waiting. At least when somebody starts to post some snippet and I get to think "I can do this much better in Python", I should have some inspiration.
pyTony
pyMod
6,299 posts since Apr 2010
Reputation Points: 879
Solved Threads: 984
Skill Endorsements: 26
My policies of these things considered 'cheating' during studying:
- I consider using all possible libraries a plus when considering the efficiency of the snippet.
- Are you allowed more than one post to Daniweb? (hint: check my post count) ;) The purpose is not to stop me reaching 100 posted code snippets, I hope.
pyTony
pyMod
6,299 posts since Apr 2010
Reputation Points: 879
Solved Threads: 984
Skill Endorsements: 26
Another point is the disqualification points, few possible cases, would these be disqualified?
- poster posts code as discussion thread asking feed back, does some suggestions and own improvements and posts it result as code snippet.
- Poster posts a code snippet and posts a bug fix after one hour as reply
- Same as 2 but he is moderator and he edits the original post
- After post as colde snippet somebody notices missing newline in output in some corner cases.
pyTony
pyMod
6,299 posts since Apr 2010
Reputation Points: 879
Solved Threads: 984
Skill Endorsements: 26
poster posts code as discussion thread asking feed back, does some suggestions and own improvements and posts it result as code snippet.
No, it wouldn't be disqualified if they received help from the community on their code and, ultimately, decided to submit the final piece as a code snippet.
Poster posts a code snippet and posts a bug fix after one hour as reply
No, this wouldn't be disqualified. If anything, it's encouraged that members want to continually improve code they contribute to our code snippet library even after posting it. It can only help future DaniWeb members looking for the code!
After post as colde snippet somebody notices missing newline in output in some corner cases.
It would be up to the discretion of members whether they want to vote on a code snippet that has small bugs for corner cases and edge cases.
Dani
The Queen of DaniWeb
21,342 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 367
Skill Endorsements: 119
Members can submit as many code snippets as they like. Only code that was contributed during the months of June and July, and unique to DaniWeb, would qualify.
Dani
The Queen of DaniWeb
21,342 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 367
Skill Endorsements: 119
Hi,
I'm confused what you mean. I'd like to think that people want to ensure that any code submitted to our code snippet library is pretty much bug-free regardless of whether there is a contest or not, and that if a bug is discovered, it will be fixed regardless of whether it's June or August or October.
Dani
The Queen of DaniWeb
21,342 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 367
Skill Endorsements: 119
Welcome!
Then prepare a good piece of code, post it to the relevant sub-forum (as a code-snippet), and post a link to that code snippet on this thread (to make it "official").
mike_2000_17
21st Century Viking
3,135 posts since Jul 2010
Reputation Points: 2,050
Solved Threads: 625
Skill Endorsements: 41
Does everything have to be in one file and in one language? For example, what about, say, a C++ program that uses a class connecting to a Java program for the GUI. That's a main.cpp file, a .h class file, a .cpp class file, and the Java file, so that's at least four. Add a Makefile and a README and perhaps a text file for the programs to read from and you're up to seven (although, think about it, it's ONE zip file ;)). It could easily get out of hand, of course, but think about it. When was the last time you coded anything cool all in one file?
VernonDozier
Posting Expert
5,675 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 738
Skill Endorsements: 18
Does everything have to be in one file and in one language?
In my opinion, it should just be in one language, unless the other-language-code is a very common external library. But, it's Dani's call.
And it can certainly be in multiple files, but I would try to keep it within reason.
When was the last time you coded anything cool all in one file?
Well, one of the coolest piece of C++ code is the ScopeGuard, and it fits in about 30 lines of code.
mike_2000_17
21st Century Viking
3,135 posts since Jul 2010
Reputation Points: 2,050
Solved Threads: 625
Skill Endorsements: 41
We are looking for single-feature snippets, not entire programs that consist of multiple files. They will remain in our code snippet library :)
Dani
The Queen of DaniWeb
21,342 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 367
Skill Endorsements: 119
The way I see it, every programmer has a bag of tricks that they use. To me, the point of the contest is to show off one such trick that you think is clever and/or useful. It can be a nice language-technical trick (e.g., doing something that people don't suspect can be done), a nice algorithmic trick (e.g., a clever tail-recursion, or something), or a very useful little tool (e.g., a kind of smart-pointer). When you program a library or large application, most of the code is boringly ordinary, but once in a while you come up with a very neat solution to a particular problem / application. The idea is to take one such trick (or come up with one) and formulate it in a self-contained snippet (like the class that implements the solution, and a basic program that demonstrates it use / purpose). Then, it will be part of the code-snippet library, and people that read it might think its just cool or a very nice way to solve a type of problem.
mike_2000_17
21st Century Viking
3,135 posts since Jul 2010
Reputation Points: 2,050
Solved Threads: 625
Skill Endorsements: 41
Dani
The Queen of DaniWeb
21,342 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 367
Skill Endorsements: 119