Having previously been disappointed by the information available on the topic, this is my attempt at categorizing different ways to implement 2D platform games, list their strengths and weaknesses, and discuss some implementation details.
Before accessing variables within objects and collections make sure they are there! PLEASE!
If that variable is a constant or won't be changed then use the Const keyword in applicable languages and the CAPITALISATION convention to let users aware of your decisions about them.
The name of a method is more important than we give it credit for, when a method changes so should its name.
Make sure you are returning the right thing, trying to make it as generic as possible.
Void should do something, not change something!
Private vs Public, this is a big topic
keeping an eye of the access level of a method can stop issues further down the line
Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.
specify the 3 main points of a test, including what you expect to happen using the following keywords GIVEN, WHEN / AND , THEN.
look at how the code is structured, make sure methods aren't too long, don't have too many branches, and that for and if statements could be simplified.
Use your initiative and discuss if a rewrite would benefit maintainability for the future.
it's unnecessary to leave commented code when working in and around areas with them.
most organizations practice continuous delivery, which means that your default branch can be deployed.
Merging everything into the master branch and frequently deploying means you minimize the amount of unreleased code, which is in line with lean and continuous delivery best practices.
you can deploy to production every time you merge a feature branch.
deploy a new version by merging master into the production branch.
you can have your deployment script create a tag on each deployment.
to have an environment that is automatically updated to the master branch
commits only flow downstream, ensures that everything is tested in all environments.
first merge these bug fixes into master, and then cherry-pick them into the release branch.
Merging into master and then cherry-picking into release is called an “upstream first” policy
“merge request” since the final action is to merge the feature branch.
“pull request” since the first manual action is to pull the feature branch
it is common to protect the long-lived branches
After you merge a feature branch, you should remove it from the source control software
When you are ready to code, create a branch for the issue from the master branch.
This branch is the place for any work related to this change.
A merge request is an online place to discuss the change and review the code.
If you open the merge request but do not assign it to anyone, it is a “Work In Progress” merge request.
Start the title of the merge request with “[WIP]” or “WIP:” to prevent it from being merged before it’s ready.
To automatically close linked issues, mention them with the words “fixes” or “closes,” for example, “fixes #14” or “closes #67.” GitLab closes these issues when the code is merged into the default branch.
If you have an issue that spans across multiple repositories, create an issue for each repository and link all issues to a parent issue.
With Git, you can use an interactive rebase (rebase -i) to squash multiple commits into one or reorder them.
you should never rebase commits you have pushed to a remote server.
Rebasing creates new commits for all your changes, which can cause confusion because the same change would have multiple identifiers.
if someone has already reviewed your code, rebasing makes it hard to tell what changed since the last review.
never rebase commits authored by other people.
it is a bad idea to rebase commits that you have already pushed.
always use the “no fast-forward” (--no-ff) strategy when you merge manually.
you should try to avoid merge commits in feature branches
people avoid merge commits by just using rebase to reorder their commits after the commits on the master branch.
Using rebase prevents a merge commit when merging master into your feature branch, and it creates a neat linear history.
you should never rebase commits you have pushed to a remote server
Sometimes you can reuse recorded resolutions (rerere), but merging is better since you only have to resolve conflicts once.
not frequently merge master into the feature branch.
utilizing new code,
resolving merge conflicts
updating long-running branches.
just cherry-picking a commit.
If your feature branch has a merge conflict, creating a merge commit is a standard way of solving this.
keep your feature branches short-lived.
split your features into smaller units of work
you should try to prevent merge commits, but not eliminate them.
Your codebase should be clean, but your history should represent what actually happened.
Splitting up work into individual commits provides context for developers looking at your code later.
push your feature branch frequently, even when it is not yet ready for review.
Commit often and push frequently
A commit message should reflect your intention, not just the contents of the commit.
Testing before merging
When using GitLab flow, developers create their branches from this master branch, so it is essential that it never breaks.
Therefore, each merge request must be tested before it is accepted.
When creating a feature branch, always branch from an up-to-date master
discussing the basic structure of an Nginx configuration file along with some guidelines on how to design your files
/etc/nginx/nginx.conf
In Nginx parlance, the areas that these brackets define are called "contexts" because they contain configuration details that are separated according to their area of concern
if a directive is valid in multiple nested scopes, a declaration in a broader context will be passed on to any child contexts as default values.
The children contexts can override these values at will
Nginx will error out on reading a configuration file with directives that are declared in the wrong context.
The most general context is the "main" or "global" context
Any directive that exist entirely outside of these blocks is said to inhabit the "main" context
The main context represents the broadest environment for Nginx configuration.
The "events" context is contained within the "main" context. It is used to set global options that affect how Nginx handles connections at a general level.
Nginx uses an event-based connection processing model, so the directives defined within this context determine how worker processes should handle connections.
the connection processing method is automatically selected based on the most efficient choice that the platform has available
a worker will only take a single connection at a time
When configuring Nginx as a web server or reverse proxy, the "http" context will hold the majority of the configuration.
The http context is a sibling of the events context, so they should be listed side-by-side, rather than nested
fine-tune the TCP keep alive settings (keepalive_disable, keepalive_requests, and keepalive_timeout)
The "server" context is declared within the "http" context.
multiple declarations
each instance defines a specific virtual server to handle client requests
Each client request will be handled according to the configuration defined in a single server context, so Nginx must decide which server context is most appropriate based on details of the request.
listen: The ip address / port combination that this server block is designed to respond to.
server_name: This directive is the other component used to select a server block for processing.
"Host" header
configure files to try to respond to requests (try_files)
issue redirects and rewrites (return and rewrite)
set arbitrary variables (set)
Location contexts share many relational qualities with server contexts
multiple location contexts can be defined, each location is used to handle a certain type of client request, and each location is selected by virtue of matching the location definition against the client request through a selection algorithm
Location blocks live within server contexts and, unlike server blocks, can be nested inside one another.
While server contexts are selected based on the requested IP address/port combination and the host name in the "Host" header, location blocks further divide up the request handling within a server block by looking at the request URI
The request URI is the portion of the request that comes after the domain name or IP address/port combination.
New directives at this level allow you to reach locations outside of the document root (alias), mark the location as only internally accessible (internal), and proxy to other servers or locations (using http, fastcgi, scgi, and uwsgi proxying).
These can then be used to do A/B testing by providing different content to different hosts.
configures Perl handlers for the location they appear in
set the value of a variable depending on the value of another variable
used to map MIME types to the file extensions that should be associated with them.
this context defines a named pool of servers that Nginx can then proxy requests to
The upstream context should be placed within the http context, outside of any specific server contexts.
The upstream context can then be referenced by name within server or location blocks to pass requests of a certain type to the pool of servers that have been defined.
function as a high performance mail proxy server
The mail context is defined within the "main" or "global" context (outside of the http context).
Nginx has the ability to redirect authentication requests to an external authentication server
the if directive in Nginx will execute the instructions contained if a given test returns "true".
Since Nginx will test conditions of a request with many other purpose-made directives, if should not be used for most forms of conditional execution.
The limit_except context is used to restrict the use of certain HTTP methods within a location context.
The result of the above example is that any client can use the GET and HEAD verbs, but only clients coming from the 192.168.1.1/24 subnet are allowed to use other methods.
Many directives are valid in more than one context
it is usually best to declare directives in the highest context to which they are applicable, and overriding them in lower contexts as necessary.
Declaring at higher levels provides you with a sane default
Nginx already engages in a well-documented selection algorithm for things like selecting server blocks and location blocks.
instead of relying on rewrites to get a user supplied request into the format that you would like to work with, you should try to set up two blocks for the request, one of which represents the desired method, and the other that catches messy requests and redirects (and possibly rewrites) them to your correct block.
incorrect requests can get by with a redirect rather than a rewrite, which should execute with lower overhead.