Imitation is the sincerest form of flattery. -- Charles Caleb Colton.
But then, what is Plagarism?
Plagarism is the sincerest form of flattery.
Software development, design and programming is a demanding creative enterprise, though often treated by unenlightened management as a tedious, repetitive labor, more akin to assembly line or factory work than art or engineering. Were you an author, and someone claimed your work, you would be protected by rules and laws against plagarism. But though the principle remains the same, society has yet to catch up with technology, and neither the offender nor the manager may even fully understand the offense.
But you need to understand your reaction, and whether you can, or should, do anything about the offense. Ask yourself, why do you develop software, why are you a programmer? Do you understand why you choose to work long hours, sit under flourescent lights at a (too small) desk (in a tiny cubicle) in front of a monitor, cloistered from human company? Is your answer, like mine, that you love to build software, that you enjoy the work, and you want to build amazing things that make people's lives better? Or is it that you want to advance in a career, earn money and accolades, and promotions? I think the answer to what action you should take is different, depending upon who you are.
You will often encounter people lacking in morals willing to claim your work as their own. They will take your ideas, claim them as yours, and even demean you as they take them from you. But you had those ideas, you are smart, and creative, you will have many more great ideas, and you will build more cool software.
You could choose to seek relief in management. Does your company have a version control system which logs your work, and the work of others. That would give you means to demonstrate to the offender and to management their dishonesty. Companies do not like it when employees demonstrate poor ethics, or toxic behavior such as dishonesty and claiming credit for the work of their colleagues. Actions like that damage the team culture most companies work hard to foster.
You could choose to interpret their emulation of your coding style, and their adoption of your work as flattery. Perhaps you could explain to the offender how you feel, and that might help them to realize what they have done. Maybe all you need is to be given credit for the contributions you have made, recognition for the work and the help you have been to your colleague?
You could choose option C, which is to look for an organization where people do not claim your work, nor feel the need to 'borrow' your work. Surround yourself with bright people and/or ethical people, who either have no need to take your work, or have the character to give you credit.
Elaborating, you can choose to take the high road, and be above the ignoble behavior, confront the behavior, or find another situation. And there are other reasonable approaches. But I would rather try to educate the offender, and help them to grow and be a better person. What you choose should fit your personality.