A computer is any very stupid machine that can execute an algorithm. The success of a computer at any given task depends on it's algorithms and it's speed. Any collection of algorithms for a specific task in a computer is called a program. Once started, a program runs to completion or loops indefinitely.
Computers can be constructed to read programs from any one of many sources, ranging from paper tape to hard drives to photons. As long as the data can be entered and understood, the computer can process it. How long it takes to process is a function of the computer's own construction. Early computers were mechanical, and very limited. As time progressed, electronic computers appeared and became smaller, faster, and cheaper. Today, a modern laptop outperforms the mainframes of 1978.
Computers in Science Fiction
In Federation starships, virtually all functions are controlled by a single, central computer system. If this computer is compromised for any reason, the entire ship is at risk. This design has been criticized for the lack of independence and redundancy in critical safety systems.
Computers in Star Wars appear to be artificial intelligences that can act on their own initiative, such as when the main computer of Cloud City volunteered information to assist in the escape of administrator Lando Calrissian.