A methodics of composing research work in programming for middle school students (1-2 years of programming experience) is offered in this article. This methodics is demonstrated using one interesting problem: secretary problem, or marriage problem. This problem is too complex to be theoretically solved in school and comprises probability theory and calculus. However it can be easy modeled using programming and it allows many modifications that can be invented by students. Moreover, results of such computer modeling allow to make non-trivial practical conclusions about decision making and optimal of choice strategies.