The article describes the methodology of learning programming for students of various engineering disciplines (chemists, electricians, programmers, and mechatronicians). The courses "Computer Training" and "Programming Languages" taught at the Faculty of Computer-Science and Information Technology of Riga Technical University are used as examples. The purpose of these courses is to prepare specialists able to use computers effectively and without error in their future careers. The course structure depends on the particular specialty area. The course structure consists of three parts: the main (theoretical) part, the laboratory part and the practical test. In this paper we show that for better development of course material it is necessary to consider the solution of specific practical problems that may be encountered by engineers of particular profile, as well as to provide current and final control of students