M
M
Maxim Kuzmin2017-01-29 01:07:10
PHP
Maxim Kuzmin, 2017-01-29 01:07:10

Who can I ask to reasonably evaluate my code and point out errors?

Good day!
I think, one way or another, any programmer in the process of professional growth is faced with the need to hear the opinion of an expert, perhaps get good advice in order to improve his project.
Actually, as a person who understands that healthy criticism is one of the most effective ways to find out your mistakes, I try not to avoid it, and sometimes I don’t have enough of it at all.
Alone, it can be difficult to objectively assess the shortcomings of your own creation, so I would like to know a way to find such people who are ready to delve into someone else's code and give useful advice, if only for the sake of satisfying the need to share experience (I'm not talking about "all-knowing" people who have worked on specialties and now impose their invaluable experience right and left).
What do you advise?
PS
For information, I just recently filed (my first!) project on github, a PHP class for captcha generation. I know it's banal, but I couldn't think of anything else but this. I have a week to polish, so collecting information bit by bit, randomly googling documentation and leafing through Habr is not the best idea =)

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexey, 2017-01-29
@KuzMaxxx

I will describe what is not ideal in the code, from the point of view of gloss.
Violated psr-1 and psr-2, missing psr-4.
There is a dog @ in the code , which is not really needed there. It could be forgiven if there was at least a check for false further (such as suddenly php-gd is missing), but alas.
Then pass the variable by reference & . Why is she? This is not an external function, $this->_image is at hand, the parameter is not needed at all, especially by reference.
Deceptive getImage method . It would be nice if it returned a binary image string, not a resource. And the resource does not need to shine at all.
Why shine $config on everyone?
Missing composer support (composer.json and .gitattributes).

X
xmoonlight, 2017-01-29
@xmoonlight

I looked, the code is well-formed, but for captcha:
1. captcha check is successful in any case
2. treat characters that are similar when writing in the same way (for example, l and 1 are the same, etc.)
3. use dynamic distortion, not static (as it is now)
4. try to generate neologism words (1-2 consonants and a vowel), use numbers only at the beginning or at the end of the word - it will be easier for the user to enter.
5. one wrong character anywhere - not considered an error (but a typo)

V
Vincent1, 2017-01-29
@Vincent1

1. Write code according to PSR
2. Use the code of popular libraries in your tasks to see what's what. After that, it becomes clear how you can improve your code immediately or the next day;)
Finding someone to evaluate the code in your case is not the right thing to do. First, let the "verifier" prove that he writes cool and understandable code :)

S
sim3x, 2017-01-29
@sim3x

The question is short
How to get advice from a senior just like that
It doesn’t happen
Look for a job where they can accept trainees

P
Puma Thailand, 2017-01-29
@opium

write useful open source

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question