Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krasimir/to-all-devs-out-there
A collection of good practices
https://github.com/krasimir/to-all-devs-out-there
Last synced: 3 days ago
JSON representation
A collection of good practices
- Host: GitHub
- URL: https://github.com/krasimir/to-all-devs-out-there
- Owner: krasimir
- License: mit
- Created: 2013-11-26T20:46:21.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-26T20:46:47.000Z (almost 11 years ago)
- Last Synced: 2024-04-11T07:12:28.104Z (7 months ago)
- Size: 109 KB
- Stars: 7
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# To all devs out there.
The purpose of the following document is to present best practices used in our company. Some of the things are mandatory, some of them not. However, it is good to follow them in the name of the team play and good project's architecture.
## Getting started
Every project should start with a new Git repository. Don't leave the project's code only on your machine or on the FTP server. Commit your changes as often as possible. The version control should not act as a file storage or backup utility. It really matters how often you upload changes. Every single moment, you or some of your colleagues, may need to roll back some modification. If there is one commit per day this is not possible. It's also important to add a meaningful message. Something like `fixing bug` or `updates` doesn't help a lot. It should be clear what you did.
Git has really powerful branch management. It's a good idea to split your work into `master` and `development` branches. Of course if the project is small you don't need to do this, but in most of the projects, this is needed. Read about [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/) and get ideas from there. Keep your master branch up-to-date, valid and working. At every moment, it should be possible to get the code from there and release it on the production server.
Create a `README.md` file. If you don't like the [Markdown](http://daringfireball.net/projects/markdown/) format use plain text. The really important thing is to get such a file. It should give enough information to every developer so he could setup the project and start working with it. Here are few things which you should put notes to:
- What is this project all about
- What are the project dependencies (libraries, frameworks etc ...)
- Steps for setupping of the project
- Steps for deploying the project
- Tricky parts
- Your name## Development
Our development stack is mostly based on [LAMP](http://en.wikipedia.org/wiki/LAMP_(software_bundle)) in the server-side and JavaScript/HTML/CSS in the front-end. We are not really bound to any technology, framework or library. Feel free to use whatever you think is right, but before to start integrating some giant multi-platform solution consider the following:
- Check if your colleagues know something about the technology. Using something that only you understand is a [single point of failure](http://en.wikipedia.org/wiki/Single_point_of_failure).
- Make sure that the chosen framework or library is well documented and there are articles or tutorials which explain how it works
- Consult (if necessary) with your colleagues. Some of them may have bad experience with the technology.
- Make sure that the tools which you want to use are actually installed on the production server. It's really easy to setup something on your laptop, but we are not shipping your machine. At the end everything should work on the official server.### Beating blank page syndrome
The blank page syndrome is typical for the writers, but also for the programmers. Very often you are sitting in front of an empty class wondering how to start. There are tons of materials about modular programming, good and well structured code, best practices and so on. You should read a lot and improve your skills over the years. The purpose of this reading is not to make you a better developer. It is trying to give you a guidelines. Before to start writing something - THINK. Even if the deadline is tomorrow you still have a chance to produce something good. Plan your work, analyze the given tasks and imagine how your application will look like. Visualize the different components and how they are going to collaborate. There is something which I call *brute-force programming*. You start typing line after line without to think about architecture, design patterns or composition. You implement feature after feature and it seems that you are doing a good job. However, this is wrong. Sooner or later your crappy code will getting buggy and will stop working. That's because it is not planned very well and the final product looks more like a spaghetti rather then a software. Here are few tips for beating the blank page syndrome:
- Testing, testing, testing - you should write tests. It is not true that following [TDD](http://en.wikipedia.org/wiki/Test-driven_development) takes more time. The true is that it leads to a better software. Try it and you will see. Once you start coding something ask yourself **"How I'm going to test it?"**. This question is like a key which opens a lot of doors. It produces classes with only one responsibility and encourages the modular programming.
- Avoid speculative generality - that's a code smell which you get when you write something just because you think you will need it in the future. And in most of the cases you never use it. Yes, it is difficult to find the balance, but try to keep the abstractions as less as possible. Implement only what you actually need.### Back-end development
In most of the cases we rely on frameworks developed by other people. Some of them are good, some bad, but we should play by their rules. Having this in mind you should follow the coding style provided by the system. If you need to write something custom make sure that it doesn't break some of the existing functionalities. Write in the `README.md` file how your code should be setup, where is the configuration and what is the main application flow.
Do not mix the back-end code with the front-end logic (in some of tools like WordPress this can not be avoided). Develop the things like that so there is another guy which will work on the JavaScript/HTML/CSS part. Code like this one is not a good idea:
getCurrentUser();
?>