We have been working hard and trying to grasp the things that are new to us. So, what do we do to help study? Here's a list of 10 things you can do to make your program more quickly and rationally. I'm more used to working with Ruby on Rails, but the following ideas apply to other environments as well.
1. Upgrade Unit Tests
Your programming is not tested? You should be tested at any time, i.e. TATFT (testing all the fucking times). Of course you should choose a better way than just unit testing. RSpec and Shoulda are two tools that you can choose to use.
2. Try Tdd
Now that you're testing, you should keep a record of the tests. Instead of recording the code and overwriting it with subsequent tests, it should be a record of the method. TDD (Test Drive Development) allows you to make better code, TATFT the most important foundation is TDD. It's not difficult to do Tatft, first you write down the simplest test you can do and run it, observe the failure of the test, and then write the execution statement so that the test passes, repeating the process repeatedly.
3. Automated deployment
Automation is your best friend, and you want to implement automatic Capistrano is a very useful tool. After you have deployed your project, the first thing to install should be Capistrano. Automating deployment from the first day will save you a lot of time.
4. Installing the SCM
Installing the SCM and learning to use it is the benefit of making the code in the overweight library less omissions and there are plenty of tools to choose from, and I use Git every day. Git is a very special distributed SCM, that is, DSCM. DSCM is very promising, and it can work with users who have other libraries.
5. Review Continuous integration
Now we've tested the code and stored it securely in the library. What is a better way to test than to keep on testing? Automated testing is a good choice. Grateful for the presence of CRUISECONTROL.RB, the utility automatically ran those trivial tests.
6. Understand your code
Writing code is one thing, but more important is understanding the code. You can use four automated tools to help you understand the code: flog, Tarantula, Rcov, and Saikuro. These tools are unique, and I'd be happy to introduce them to you.
Flog, you can record complex results in alphabetical order.
Tarantula, according to the principle of relevance and some flexible creative design. What it does is spider your rail application to search for bad links. It was a relief and a great benefit to me.
Rcov, this is a very popular tool in the Ruby World. It is a C0 scope tool, in other words, it accurately determine which parts of your code are being tested and which parts have not been tested. The only drawback is that it cannot test such things as: "If condition_a && Condition_b | | Condition_c ". Such a statement.
Saikuro, you can measure the complexity of your code loop, that is, you can calculate the number of branche and path of your code. Of course, the lower the complexity of your code, the easier it is to run.
7. Upgrade your fixtures.
Fixtures is one of the things that looks very creative, but there are many drawbacks. For fixtures, there are only a few alternatives, and I chose to use rails scenarios because it worked like fixtures in the test, but it allowed me to do a better DSL than YAML. I can also specify multiple scenarios within a file, which will make things more organized.
8. Collect profiling objects
Build a new system on the rail platform. New monitoring tools appear every week, so we have a lot of choices, and here I introduce the tools I've used: Hoptoad and TuneUp.
Hoptoad has a good capability for exception messages, which can collect intermittent applications and display the results in a simple way. Also, this is a free software ~
TuneUp uses another way to get the data, which calculates how long each place takes to assemble itself. Does your page take a long time to build? But you don't know why it took so long to use tuneup to check it out, and you'll find something you've never thought of before. In addition, TuneUp is an open-source software that you can log into their hosting services to share your results.
9. Read other people's Code
Do you want to be a better programmer? Be sure to read more code, which includes good, bad, your own, and other people's code. Reading code is a skill that many programmers don't value, but it's a great need to be able to quickly read someone else's code and understand what it means.
10. The habit of writing a blog
Personally, I can find all the information when I'm reading a blog. Most of the time I write about technology-related points and occasionally discuss easy topics. Blogging is about sharing, and you can write down technical techniques that can help you save time, or some technical difficulties and commands that you want to remember.