Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello,

I'm beginner in programming, and I learned a lot of functions but I don't have any experience in practice. So I would like if anybody has and is willing to give me some code (or photos of that code), but something correct and professional so I can see how is it work in the real world. I have a lot of questions like:
-How to organize folders and files in solution?
-Where to set classes, interface,forms and stuff like that?
-When I want to make connection to database which is the best way to do that actually should I every time write code for connection or is there any better way for example putting in method, but then how should I send the query?
-Example of abstract and interface usage, because I don't know why make them if you need to implement their methods, isn't then easier just make that methods in the class which you use?

There is much more questions. Everything would be useful.
Sorry for my English :D and thanks in advance.
Posted

1 solution

First of all, you really should understand what programming is, and what does it mean, learning programming. It is not learning "a lot of functions", not even close. Good developers rarely remember many "functions" and other boring facts, why? The learning is learning of the ideas, understanding, and, yes, practice.

And this is the ability to recognize problems and, sometimes, ask good questions. You will see how weak are your questions are if you see my answers:

  • Organize folder and files?
    It's totally up to you.
  • Where to set classes...?
    It's totally up to you.
  • "When I want to make connecton…"
    You did not specify any particular problem. I would suggest you not to work with databases (and also UI, graphics, networking and other advanced topics) until you gain a log of confidence in the basis. Remember, the slower way leads to the goal faster.
  • Abstract and interface usage.
    Again, it's hard to see what are your problems. Please see my recent answer: confuse with object creation of interface and abstract Class[^].
    Also, see my comments to OP in this thread. The person who asked that question as not clear enough about those concerns, as well as you are.


When I say "totally up to you", you should not read it as "it does not matter". Those are probably the least important concerns, but they do have some importance — the code structure should be neat, well planned and transparent, well organized, well readable, and rational. You problem is not that you don't know a good recipe for that; your problem is the misconception that such things should be organized according to some recipes. Instead, you should develop the ability to create your own recipe each time you decide on how to organize your code. This is not as difficult as you think now; you should be just accurate and logical. And experienced, but it comes with, no to much of surprise, with… experience.

I can expect that someone may advise you to organize code the way default Visual Studio template do: namespace structure strictly follow the structure of project sub-directories, each type is placed in a separate file with matching name. Do you want to know my opinion? This is acceptable but… just silly. Visual Studio template work this way by one simple reason: people found some simple way to auto generate code while keeping it reasonably well structured. But you are not the program which is required to be simple enough. If you have good reason to create better structure for some particular purpose, don't hesitate to do it. For example, use partial declarations and group many small types in bigger groups in the same file, at the level of namespace or even as nested types (gosh, I saw many "recommendations" against nested types, and all of them not motivated at all, just religious :-)).

More general thing: don't follow the style of auto-generated code. Its style is not suitable for real programming by a human developer. And it uses way too narrow set of expressive capabilities of the language, again, for better compatibility simplicity of code generation. These criteria has nothing to do with criteria of good source code.

—SA
 
Share this answer
 
v5
Comments
The14thNoah 19-Feb-14 21:16pm    
"the slower way leads to the goal faster" you got it man,. . .
Sergey Alexandrovich Kryukov 19-Feb-14 21:40pm    
:-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900