Can controlled dose of Codeine improve brain's functionality?
the first time you take them you will feel better, think sharper, and
  act better


You are probably thinking of amphetamines, not opiates. Militaries have used amphetamines for just that purpose for decades, particularly for situations where long periods of attention are necessary. The problems are addiction, adaptation (lessening effects over time), withdrawal, side effects, etc.

Caffeine has very different cellular effects, but is also a stimulant, albeit a much weaker one. People around the globe use caffeine to achieve much of what you are suggesting on a daily basis. I actually think caffeine is a great example of what you are proposing, because (at least for people who tolerate it well and don't have any other conditions) it is safe, effective, and has less serious withdrawal symptoms and is somewhat less addictive than many other drugs. That said, among people who use caffeine regularly, some of the benefits begin to wane, and people start needing caffeine to maintain their normal level of alertness.

People with ADHD (and some others without, particularly students) also take amphetamines to help with attention (Adderall is an amphetamine; Ritalin/methylphenidate is closely related). There is a bit of controversy over whether that's a good idea or not. All of these things have side effects, including potential for changes in personality, anxiety, and various peripheral side effects, as well as the risks of dependency and symptoms of withdrawal.

Codeine and other opiates, on the other hand, are primarily useful for blocking pain. They are often associated with euphoria, but their other psychological effects are mostly depressant: drowsiness, respiratory depression, suppression of gut motility leading to constipation, etc. I'm not aware of any cognitive enhancement from codeine, unless the cognitive task you are trying to perform is sleep.