I would like to share the various problems that occur in smartphone game development that I am involved in and what tools are used to solve them.
When I was talking to a colleague, I was told that it would be nice if other teams were doing something useful and shared, so I would like to share my team first. I'm developing with python, but I think there are many common problems that can occur anywhere. I'm a server engineer, so I'm a little server-oriented.
problem | Countermeasures |
---|---|
Before I knew it, the code I wrote was changed in an unintended way. | Code review |
Reviews are filled with indications of coding convention violations | Formatting tool that conforms to coding standards |
I don't know if it's a good code to review or if it's still in progress | In the review title[WIP]Add |
After deploying the development environment, the client says that the server cannot be connected due to an error. | API test / integration test introduced in Jenkins |
Frequent changes in master data and data inconsistencies | Automatic modeling and validation with Jenkins |
The client does not understand the specifications of the API created by the server | API document automatic generation |
I want to try out the API, but setting the URL and post parameters is troublesome | Make a request with API documentation |
I don't know who is currently doing which task | Managed by backlog |
Tasks to be done in the future are forgotten | Managed by backlog |
The client says there is an error on the server, but I don't know what kind of request I made | Get communication log of request |
I want to identify slow APIs and prevent them from being released before they are released | Introducing New Relic in development environment |
I want to see if the server performance comes out | Load test |
I want to reproduce the user in the production environment in the development environment | User export on the management screen/import |
When one or two people are writing code, they are always able to work together and it is easy to follow the commit log, so there are many cases where there is no problem even if you do not perform code review. However, with a large number of people (6-7 people in my team), I often mess with and use other people's code, and the load increases without using it as the creator intended. It will be chilly and will cause bugs. Above all, if only one person understands the code, the response to a failure will be delayed.
We have introduced a code review to solve the above problem. I am using ** Stash ** and it is called a pull request in Stash.
Make pull requests by feature as shown below and ask team members to review them.
It's time to merge, but in my team, if two or more reviewers approve, the person who made the pull request can merge. If everyone approves the review, we do so because it takes too long to approve.
However, the process of approving itself certainly causes a wait for the person who made the pull request, so it is a promise that small changes can be merged without reviewing.
I've seen code reviews on overseas blogs before, and I've merged them, so I thought there was certainly such a way, but I think this depends on the situation of the team.
The team is committed to PEP8 compliance.
On top of that, the problem with starting a code review is the review point that it violates the coding conventions. This point itself is straightforward, but both those who do it and those who do it feel like a waste of time and are barren.
You can avoid the problem by making a pull request that does not violate the coding conventions ** before reviewing **.
The following methods can be considered to achieve the above.
We recommend methods 1 and 3 within the team. To do the first, after committing with autopep8, let the committed file automatically fix any coding violations. I will write the detailed method in another article.
In the early days, when I looked at the pull request list at the time of code review, I couldn't tell from the title whether it was a good review or a temporary one I gave before the review.
To solve this, I added [Review] to those who can review it and [WIP] to those who do not want to review it yet. WIP stands for Work in Progress.
Even with code reviews, bugs are still there. To prevent this, after merging, Jenkins will run the test and if it is OK, it will be deployed to the development server.
In the following environment, I set up Jenkins on another Mac in the company, poll the change of the develop branch in Stash, and deploy it every 15 minutes. I'd like to run the test as soon as it's changed from Stash to Web Hook, but I'm polling because it's in-house for security and cost reasons.
The test runs the following test with py.test.
The integration test takes too long, so if the API test passes, I will deploy it to the development server.
Game master data is data that is a unit parameter or a quest parameter. The original file is Excel, but it is complicated due to various reasons. The following is an outline.
The server code reads the master data and uses it on the code. It is a waste of time to manually update the server code every time it is updated, so Jenkins will update it automatically.
Another problem with master data is that it often has more columns in the master data. For example, it seems that the master data of the unit has skills and the skill ID has increased. As a countermeasure, on the server side, one model source code is associated with one master data, and when extending the function, it is wrapped and the method is written.
For example, it has the following form.
application / module / unit / models / unit.py #Models for unit master data (Unit) application / module / unit / models / unit_wrapper.py # Unit model wrapper (UnitWrapper) application/module/unit/models/init.py
init.py is defined as follows
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from .unit import UnitWrapper as Unit
Then, when referencing from the outside, UnitWrapper can be read as a Unit by doing the following.
from module.unit.models import Unit
This unit.py part is automatically created by running the script, so you will not have to worry about updating the master data. This part is not automated by Jenkins, but of course it can be.
It is a problem if the server side creates an API and its specifications (request parameters and response parameters) cannot be confirmed. There is a pattern to write in Confluence etc., but it does not make sense unless it is constantly updated, so it is preferable to work with the source code.
There are Swagger etc., but in my team, I realize it on the management screen by myself.
The APIs are listed. It will be added automatically when you create a new API.
API documentation example for player / signup
As mentioned above, the team members made the ones that can understand the request and response.
During development, you may want to hit the API to check the response. There is Advanced REST Client etc. as a Chrome plug-in, but it is difficult to maintain as APIs are added every day.
You can also issue a request from the API list on the management screen that was mentioned earlier.
It will be added automatically when a new API is added. In addition, you can save up to 5 parameter candidates, which is useful when you want to try different parameters. Once set, it will be automatically saved in the browser. The members have additionally developed the part where you can try multiple parameters.
Since it has become long, I will write "Part 2".
Recommended Posts