E
E
Eldar Musin2011-06-28 21:26:49
PHP
Eldar Musin, 2011-06-28 21:26:49

How to wean an intern from govnokoda?

Took on an intern for a project.
I was prepared that he knew nothing and that he needed to be trained. Thought I had some patience.

The first two days, he listened attentively and asked questions. Showed him what is HTML, CSS, PHP, MySQL.
Asked him to do simple tasks, small functions. But every time we step on the same rake. He does not want to delve into the manual.

When in the search results, I advised him to use regular expressions and read about them. He did not stay two minutes, he went to write. Well, I thought he understood. And he rewrote the preg_replace () function in his own way. Fifty lines of code and 4 hours of work. I delved into the task and did it with regular expressions in 1 line and in 5 minutes.

Constantly the same. Reading values ​​from a file that are separated by commas, he was smart with finding matches by subtracting the excess, copying the data and calculating the position of the character. For 20 minutes he proved to me that it is impossible to make it easier. In 2 minutes, I found in the manual strtok($string, $token), allows you to pull out a word, up to a specific token.

And in the same task, two variables are passed, which can contain 2 of 5 types. Moreover, each type either starts with a special character, or has a certain length. His code consisted of a series of if-else in several floors, in the end for 250 lines and 2 days of work. With the help of strncmp($string1, $string2, $length) I fit in 12 lines and 4 minutes including searching for a function.

I understand that he has less experience. Maybe I'm explaining something wrong? Is it really that hard to ask me, or Google how to do it? Share your experience on how to put it on the right track?

Answer the question

In order to leave comments, you need to log in

39 answer(s)
S
Sergey, 2011-06-29
@butteff

Well, I taught the cat to the tray like this:
I poked into the shitty code and beat it! Now he programs great on the tray

A
Alexey, 2011-06-29
@Sterhel

Did you take a relative?

K
Konstantin, 2011-06-28
@Norraxx

I think that he did not understand the regular season, due to the fact that this is a completely different universe for him. After all, look at it realistically, he is a beginner, he wanted to cope with the task => good! BUT!!! If you gave him an “easy” manual on automata and harmonics, he would understand what preg_functions are. Unfortunately, I think that preg_functions should not be wanted from beginners right away, there you need to delve a little into the problem. ;-)
And in general, I rented automatic machines at the university for 2 years in a row, so I know what kind of crap it is.
Maybe he feels bad, pressure, etc.?.. Explain to him that he has a lot of time, and that programming is 60% search, 30% brain activity and 10 coding… I think the main thing is to try !

A
Anatoly, 2011-06-28
@taliban

“The first two days, he listened carefully and asked. Showed him what is HTML, CSS, PHP, MySQL. O.o Give him about three books, two weeks of time and let him sit at home and read, after two weeks check what he read at school, and if he read everything properly, continue to work with him, this is your “learning” will come out sideways!

N
Next_Alex, 2011-06-28
@Next_Alex

Actually the most effective has always been a blow to wages. If it’s not possible to introduce fines for shitty code and wasting time on nonsense, then I would try to drag him to a beer and in a relaxed atmosphere find out what’s what, try to convince (or just get interested in writing normal code, at least “weakly”), well and if unlearned, then into the air.

L
lifelover, 2011-06-28
@lifelover

Sooner or later, he will begin to focus on php.net and will know where and how to look. =)

K
Konstantin Kitmanov, 2011-06-28
@k12th

What did he write on before?

N
nldr, 2011-06-29
@nldr

If the intern has been working for less than 3 months, then you have an excellent intern.
The main thing is to be able to solve problems. And how to do it more effectively will come with experience. For example, I suffer a lot from the fact that instead of making decisions in the forehead, I sit for the same 4 hours and think about how to write in 5 minutes in 1 line.

A
Alexznadr, 2011-06-29
@Alexznadr

(There is a chance that you took the “wrong” intern. Judging by your comments above, I realized that he has 0 experience in programming. And the point is not the presence / absence of “work experience”, but that a person who is interested in doing this - often writes programs “for himself.” “Strong interest” is one of the main components of success, and self-written hobby programs are just a sign of interest.)
How to work with him (especially good if there are no hard deadlines)
Formulate a task (preferably related to programming, and not changing width: 200px to wiidth 300px in a css file) (most likely at first it will be related to procedural programming), ask to think about the solution and (because experience is 0) and write it down in your own words on a piece of paper/in a text file as a verbal description of the algorithm.
When it's ready, you look at what he came up with. At this point, you will be able to see the places where he tries to implement library functions and for these places you will advise him to read the relevant documentation. In addition, if at this moment you see that it is nonsense, you can either lead him to the right thought with leading questions. Or if the question is rather complicated - offer your own version and ask what he thinks about this: advantages-disadvantages-which is better.
As soon as the algorithm is corrected, it will be easy for him, using a dictionary, to translate from one language to another.
When it gets better with the procedural style, it's time to familiarize him with the coding standards adopted by the company (It's very good if they are without stupidity and fanaticism).
OOP. If you are sure that you have the right OOP and you really need it, then “when the time comes”, then let him first get acquainted with the principles of SOLID and the basics of UML (class diagrams, objects, sequences) - this will help you discuss architectural solutions. And then the same thing: the task is formulated. He thinks it over, tells how he decided to do the decomposition and why. You offer your choice. All this is discussed based on the principles of SOLID.
That's about it. We do not allow ourselves arrogance and phrases like “what do they only teach you at the institute” and “well, who writes like that”, do not forget to praise when he does everything right.
but, I repeat, the main thing is that he himself wants it. If this is the case, then only have time for him to issue new books and invent tasks.

S
Shedal, 2011-06-28
@Shedal

I think it would not hurt to invent a few bicycles for experience :) In the end, then you begin to better understand how the ready-made solutions that you use work approximately.
And how to teach how to use ready-made is a difficult question. The main thing here is the way of thinking. When you start doing something, first look to see if someone has implemented it for you? After all, 99% of what I implemented :)

G
GraD_Kh, 2011-06-28
@GraD_Kh

What is his work experience? Earlier than 3 months after the start, it is not necessary to demand something from a beginner, his main task at this time is learning, and not closing tasks on time.

W
warbinox, 2011-06-29
@warbinox

I think you don’t need to do anything at all, let him write fifty lines instead of one, the main thing is that the task is solved, and over time both experience and laziness will come :) cheer up, include in the project, just leave it to support this part when the time comes for something correct or supplement, he himself will understand everything.
and the ideal code does not exist, who said that your task in 1 line cannot be solved in half? or even rewrite this piece so that it does not exist? There are a lot of options, let the person think for himself and decide :)

K
kk86, 2011-06-29
@kk86

I do not want to offend you, but to advise the beginner to use the regular season, it should have been guessed.
And if constructively, then hammer, hammer and hammer, how to write code correctly. Pair programming, code review and more. Repetition is the mother of learning.
Oh, and give me some books. For example, the classic Code Complete.
I wish you good luck. Cultivation of personnel is worthy of respect, it does not often happen.

I
int02h, 2011-06-29
@int02h

Do you know how we were taught in the first year? They gave a task and forbade using language constructs or standard library functions (although many did not know them anyway), which allowed solving this problem in a couple of dozen lines of code. Then the teacher at the lecture showed how to solve it easier. Plus two: firstly, you begin to understand how standard functions work, and secondly, you memorize them, since, in fact, you yourself invented them.

S
Slonoed, 2011-07-14
@Slonoed

OK-OK. It will pass.
Now he just has a period of euphoria - wow, I can write programs!
He was like that in the beginning.
Just throw away all of its code for now.
It is necessary to gently show the correct (your) code for the time being
and discuss it with him.

N
Negor, 2011-06-28
@Negor

Excuse me, what is your experience? I think more than six months + time for experience. The trainee is not yet able to gain experience. No idea where to look and what to look for. Teach it.

G
Gibbzy, 2011-06-29
@gibbzy

The question of motivation is very complex.
The carrot and stick method says a very interesting thing.
I often didn’t care about money, I was more interested in the opinion of the people around me about my creations, more experienced programmers lowered my morals to the fullest, saying that I was worthless, that I did everything wrong, etc. I was very frustrated and wanted to quit often, but the next day I would definitely sit down and try again and try and try ... until I learned.
A person simply does not know how to make it easier, I think that if he knew, he would stop writing this and start using the right functions in the right places. Because it's just faster. Maybe it's worth creating an atmosphere that "AAA we don't have time for anything" to make a person think about how to do it faster.
The main thing is for him to understand that in any task there is the most correct way to solve it, and sometimes it’s worth spending time to think and look for this way, and not to fence the first solution that came to mind “In the forehead”.
Maybe a person with his consciousness is still at the university, and he just needs to work.
In general, in your situation, a lot depends on the personal qualities of a person, which we, sitting here on the other side of the monitor, cannot evaluate in any way. And you, I think you can find an approach to this person.

I
Igor Petrov, 2011-06-29
@KriegeR

Try telling him which way to dig. More recently, I published a topic that half, even more, consisted of pure crutches and shit coding (I still have little experience, because I myself am a trainee :) ). People in the comments advised where to dig and what to look at. Understood, looked, tried to run. There are no problems with this. Explain to him that all entry-level decisions have long been made for him and let him not try to reinvent the wheel. It's not really needed...not here. This kind of creativity is needed in solving problems, not inventing new standards.

V
Vladimir Chernyshev, 2011-06-29
@VolCh

It looks like he just doesn't know the standard library well. Make you read php.net or a book describing the most commonly used functions.

K
Kindman, 2011-06-29
@Kindman

Let him write automatic TESTS for the project.
Much more benefit will be from his activity.

N
Nordvind, 2011-06-29
@Nordvind

Interesting practice. I didn’t think that they take a person who is absolutely not familiar with programming as interns. At the same time, what has already been said, I advise you to read the actual articles about shit code (not bad on Lurk) and watch A. Solntsev’s presentation “WTF Code” http://www.devclub.eu/2010/08/13/video-wtf -code/ .
Explain that the code must not only be written, but also maintained, after all.

S
savados, 2011-06-29
@savados

You have to teach, but you don't teach. You now: gave the task, he decided badly, I did well, showed him. But it’s necessary: ​​he gave the task, he decided it was bad, I explained why it was bad, sent it to be redone, and so on until it becomes acceptable.
Did you write your preg_replace()? Show why it's wrong, send a rewrite. Bad again? Rewrite again.

I
Ilya Ableev, 2011-06-29
@ableev

<jоke>And this evening, the trainee will find enlightenment, he will go to Google for regular expressions, stumble upon habr, go to qa, and ....</jоke>
Although ...

D
Dmitry, 2011-07-01
@mezastel

Teach, show how to, review the code.

M
maratfmu, 2011-07-01
@maratfmu

Hit him on the hands!

@
@resurection, 2011-07-04
_

When I started learning programming (started with php), then, probably, the first year I just learned the basics of syntax and principles. For example, if you write unset($arr[23]); - what will happen: will all subsequent indices shift or will there be a hole? How about not having a hole? If all variables are replaced with values ​​in double quotes, will the quotes affect the date("Ymd") function? But what if I need to split the date into two lines with br? And how to "glue" two numbers: 1+2=12?
In general, there are a lot of basic questions that are not explicitly spelled out in the documentation or are described somehow in a veiled way (there are no numbered arrays in PHP, only associated ones!). I spent a lot of time on such questions in the first year. I didn’t even feel the databases - everything is in the files. But then I programmed for myself and understood that until I made several sites on my own, getting a job was stupid. And you want: the first two days, ... showed him what HTML, CSS, PHP, MySQL are. Two days is not enough even to choose a convenient IDE, and you give him 4 languages!
As a result: either do not save on programmers, or pay a small salary for the fact that he does not have time to do anything. And this prog must first write at least a couple of sites for himself / friends, and only after that ask for money for his work.

R
Renat Ibragimov, 2011-06-29
@MpaK999

It’s too early to write to him, let him document the existing code, let him understand current projects and comment on every necessary line, after 1-2 files, check if he figured it out correctly.

E
ertaquo, 2011-06-29
@ertaquo

Just give him a new task and wait a couple of weeks. Then give him his old code, say "fast, urgent, ugh!" I myself was taught in this way to give clear names to variables, format the code, read the docs on the subject of “how to do this quickly and in two lines” and write comments (at least in difficult places). True, I screwed up the project and had to start from scratch :-)

T
terrier, 2011-06-29
@terrier

>> Maybe I'm explaining something wrong?
Yeah, more than for sure;)
But teaching a trainee a more or less acceptable style is usually easier than changing yourself.
But in general it is difficult to demand from a person without programming experience to immediately write in a good style. Documentation, positive and negative motivation, conversations about life and profession will help here, but the main thing is the experience that comes with time.
Right now, apparently, it makes sense to admit that he does not understand what you want from him. Perhaps it makes sense to give it a document with clear statements of good type style:
- formatting
requirements - variable naming requirements
- use standard implementations for such and such algorithms and data structures
Code written in violation of this document is simply not accepted.
You can also recognize him as untrainable and kick him out, but judging by the description of the recruitment process, there is a good chance to accept the same.

D
Dmitry Bykadorov, 2011-07-01
@hudson

Review the code.
Learn.
Curate. And teach
again ...

@
@nolled, 2011-07-01
_

Are you still paying him? How many years? What Q/O? If after school - if the budget allows, leave it, if not, then kick on the street without any doubt.

C
CKOPOBAPKuH, 2011-07-04
@CKOPOBAPKuH

the key point is whether the trainee wants to understand or does not want to. if he wants, tries, but he does not succeed - this is one thing. he needs help and teaching. if he does not want to understand anything, and is only trying to get you to get rid of him, this is another.
It seems to me that you should not imagine yourself a teacher and try to teach. once in 3 years they didn’t teach him, then you are unlikely to succeed either. he should study on his own, and you are rather an older comrade, from whom you can ask something and who can explain and tell in detail.

H
HighOctane, 2011-07-13
@HighOctane

How did it end? Is it progressing more? I think it makes sense to write a separate post on Habré.

A
Ariel Feinerman, 2011-07-13
@arielf

Don't you think your student is just not capable of programming? This is an engineering job, not everyone has the ability.

M
MaXyC, 2011-07-14
@MaXyC

will gain experience to a certain level and will use manuals / did I like crutches more until some point? but one day something in the head of that and the manual settled at home =)

Y
Yaraife, 2011-07-14
@Yaraife

For ease of communication, let's imagine that I am a trainee and I want to understand what you want from me?
I think that I already know a lot, because I can write anything from simple functions! It just takes time, but you don’t limit me in time, do you? So right? so why should I rush, I'm still interested in understanding all this. And how the code will work is not important to me yet, you do not limit me by the size of the allocated memory or processor time (/something else?)
Then what are you dissatisfied with? I'm writing code that works! I am cool!
I hope the hints are simple and clear.
[Just in case, the advice "use only Jedi methods in one command" is incomprehensible and inapplicable. Let's get more precise limits, moreover. what you _really_ need. Do you want just one line of code, and you don't care how it works? Set a code size limit. Do you need fast and light code? Check the speed of execution of the code written by him. He is not yet as lazy as you, to look for a command for half an hour to write code in 5 minutes, this only comes with experience, and it also requires an understanding of the conditions and restrictions that you, unfortunately, do not set ...]

M
mrkraftx, 2014-08-09
@mrkraftx

I remember myself like this,)) These are all skills, a rake, gaining knowledge.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question