As an OOP guy coding mostly in Java I like thinking in terms of reusable objects and classes and even if many CG problems are different, there are many ones that have things in common, especially the ones involving graph representations and algorithms.
When I start working on a problem I first open my external IDE where I can code my usual way - I can create as many classes as I need in separate files or reuse them from other CG projects. When I’m ready to test the solution there comes a little bit of a nightmare:
- I need to find all the classes used by the solution scattered across multiple packages and combine them into a single file, removing any package definitions
- The final single file can become quite big which makes it hard to find fragments of code that need to be fixed
Maybe this minor difficulty doesn’t look too bad, but speaking about OOP languages, I think the current single file IDE just makes it harder for beginner developers to think about elegant code, by forcing them to think in a procedural way and in terms of static methods of the main class where you may need to pass a ton of arguments and possibly expect more than one return value from a method
Now I don’t claim this is a must-have and I don’t know how hard is it to implement/integrate or whether it’s already on the radar. But I’m convinced this might actually be easier done that thought if correct restrictions are put in place and I’m sure it will be added some day
you need your own helpers lib/class?
Having the ability to use my own shared library for multiple projects in the CG environment would be fantastic but this is probably too much to ask.
The main point of this topic was to ask for a way to conveniently structuring the code at least per project. This would allow people to (potentially) better think about their solutions in terms of code design, detect parts that can be reused when solving other problems and less time WTF-ing when looking at the code months after it was written.
imagine coding mostly in C/C++ and needing not only separate file for every class but also headers for that files
i don’t want to start pro/con OOP holywar here, i know that is good coding practice in Java to have separate file for every class, but here programming is rather ordinary
for most tasks we write one (main) method/function which returns just one string/int value - that is junior’s job
if you have solution/answer class than all your additional methods (sorting etc) are just public members of that class, and data structures (classes in Java) are too, so no incapsulation, and totally no room for inheritance/polymorphism
remember that programming = algorithms + data structures, algorithm is main thing affecting productivity here
nobody else except you are changing you solution, so there will be no issues during merging, no conflicts - so this is against multiply files too
no solution here is longer than 3 pages / 200 lines of code (maybe on very hard tasks it is not true) so it is hard to lose the idea while coding
there are code golfing tasks here, how do you imagine winning them with your approach?
for you information at least couple of times people tried here open sockets or get access to external database servers to implement external data procession, so your idea will definitely have some support
[quote=“bvs23bkv33, post:4, topic:757”]
i don’t want to start pro/con OOP holywar here[/quote]
Me too, I perfectly understand your reasons which are valid, though code golfing exercises are a completely different type of problems that require a different thinking (but I would actually fire the team of devs if they would always write code like that )
Ultimately everyone here has the right to code the way they feel comfortable with and without code reviews nobody can tell how good/bad their code is as long as it works.
I was aware that this proposal probably was not going to add much value except maybe for a small percentage of people. I was curious to know what the community here thinks about this idea and looking at the comments’ activity it seems that this functionality is not needed.
people are offered here over 20 languages for tasks solving
and tasks are composed to use common features of all languages, not distinctive
so only if you code in Closure you will have something different (maybe Haskell too)