You don't have access to read this article
Codingstyleandguidelines
https://secure.gravatar.com/avatar/9ac685530a8f68df45ad875961cae1f5.png?d=wavatar&s=28
Sun Mar 13 21:19 Authored by Cocotus
= General Guidelines=

As the codebase is managed by several people we tried to make it easier to maintain and review. We ask everyone to try to adhere to some simple guidelines as much as you can: *keep it simple, if complexity is needed add a comment to explain why *avoid duplication of code, if mandatory or needed please comment *read all the code before changing it, avoid duplication of almost identical functionalities/classes/data. In case of doubt, please ask We know everyone knows and agrees on these principles, but the more we work on the code, the more we discover how these simple principles have not been applied even by us (the core development team)...

Scraping  

We made a major effort in reviewing the core of Ember Media Manager, the scraping process and part, to bring it to the next level. Here are major points to consider: *IMDB id is the unique identifier for movies. *It is INTENTIONAL to separate the scrapers in three groups (Data, Poster, Trailer). We decided that the small overhead of code in the modules manager and some duplication of code was a far minor issue than the complexity (or mess) that had evolved in the multipurpose scrapers, making it complex to fix and almost impossible to add new ones quickly enough. *Data scrapers will be executed one after the other and will fill ONLY selected & empty fields if not locked from global properites *Each Data scraper will have the search dialog (is a known and accepted code duplication) because there are TOO many differences between IMDB, TMDB and other so having only one dialog in main would lead to a mess. *Image scrapers will work in parallel and will return a list of images. The image selection dialog will merge all lists and show them. The dialog will be moved at main program level as is useless to have it replicated in the scrapers *Order in Image scrapers will only be used for automated scraping where only the first one will be invoked (to be quicker) *All the file save-handling logic with the names etc... will be put at main program level and will happen only once. *All image Handling (load-save-fromWEb, etc) MUST be in only in the Images class and must use the memorystream as source (already almost there in 1.3.0.12) *Trailers should behave as images

Coding Styles  

Consistent and clear coding style makes it easier for other people to figure out what you were trying to do. It also lowers the learning curve and lets more people assist when needed. As a general rule, when in doubt, go with the MS Coding Style Guidelines.

Language  

Visual Basic is the language chosen by this project's owners. Having said that, completely contained components that interface with the main project can be written in any .NET language (such as C#), however keep in mind that it is easier to maintain the code base when the developers devoted to the project are comfortable in the project's language.

Comments  

Comments are strongly encouraged, both at the method level and in-line. The code is obvious to you when you are writing it, but for someone trying to pick it up for the first time, it may look like spaghetti. Get in the habit of commenting your code BEFORE you write it.

Method Comments  

Method comments should be created with the appropriate XML comment tags. The simplest way to do this is after you have created your method stub, press the single-quote (') three times (''') and it will generate a default comment stub. Fill in the details, remove things that are redundant, and add things that might assist. If you assume the reader knows minimal Visual Basic, then you will have the right level of detail. The clearer you can make it, the more assistance from the general public you will get on debugging.

As a bonus for using XML comments, the method descriptions and parameter descriptions appear in IntelliSense popups while coding, taking the guesswork out of using those methods.

The exception to this would be default object methods, such as dialog load methods. Therefore, the following line would not require a method comment block to be inserted (but it would never hurt).
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


Custom user-created methods should always be documented.

Public Sub InstallNewFiles(ByVal fname As String)


Inline Comments  

Inline comments can be added in the standard way by using the single-quote (') followed by the text of the comment.

Comments 0

/unthemed/mono/no-comments.png
Expand, collaborate and share
Post a comment and get things done