TITLE: A "clean" approach to integrals.
QUESTION [17 upvotes]: Many fields in mathematics start from the "dirty" approach. In calculus we do all sort of $\epsilon$-$\delta$ stuffs, until topology gives an elegant formulation using open sets. A first course in linear algebra usually starts with defining matrices, their multiplications, determinants, etc, then the whole theory is built upon that. But if we start from vector spaces and linear operators on them, everything seems to fit in much more cleanly.
What about integrals? There are at least two approaches to define Riemann integrals: upper and lower integrals; or Riemann sums of partitions. None of them looks elegant to me. So, is there a "clean" way to develop the theory of integrals?

REPLY [11 votes]: I don't like very much the distinction clean/dirty which most of time hides a preference for formalism rather than constructivism. And I'm not sure that formalism is the best thing that happened to mathematics.
For you, is cleanness just encapsulation or different approach ?
Anyway, the following construction of the Riemann integral should satisfy you.

Let $I$ be a segment of $\mathbb R$. Consider the vector space $\mathcal C(I)$ of functions $I\to \mathbb R$, together with the norm $\| \cdot \|_\infty$. It is a Banach space (i.e. it is complete for this norm).
Now, consider $V$ the sub-vector-space of $\mathcal C(I)$ generated by the indicatrix functions of the form $1_{[a,b]}$, $a,b\in I$. These are the step functions.
Define a linear form $\int : V \to \Bbb R$ by the formula
$$\int 1_{[a,b]} = |b - a|$$
At this point, you have to check that this definition is well-founded by checking that if the finite sum $\sum_i \alpha_i 1_{[a_i,b_i]}$ is the zero function, then $\sum_i \alpha_i |b_i - a_i|$ is zero as well.
Check that $\int$ is $|I|$-lipschitzian, where $|I|$ is the length of $I$, that is to say $$\left|\int (f - g)\right| \leqslant |I|\| f - g\|_\infty$$
Remind this wonderful and easy result :
Let $X$ and $Y$ be metric spaces, and assume that $Y$ is complete. For every $V$ subset of $X$ and $f : V\to Y$ uniformly continuous, then there exists a unique  extension of $f$ to $\overline V$ which is uniformly continuous.
Apply this result with $\mathcal C(I)$, $\Bbb R$, $V$ and $\int$, to obtain a linear form
$$ \int : \overline V \longrightarrow \Bbb R$$
This is the Riemann integral on $I$
Check that $\overline V$ contains all the continuous functions, and much more, and is complete. The functions in $\overline V$ are called ruled functions, or regulated functions. Note that you don't obtain every Riemann-integrable function this way (cf. Sam L. comment).

How ever, it should be noted that even if this approach simplify the construction in itself, it does not simplify the proofs about the riemann integral any further, and it is very important to have a concrete representation for this completion $\overline V$.
EDIT
I've been kindly asked by email to detail this answer, so here I am ! I don't know any book or other reference having this point of view, I'd be happy if somebody had a one.