Let's stand back a bit -- sometimes it is worth thinking what's behind a convention.
So: start by thinking how, in practice, we informally prove that there's exactly one function that satisfies a certain description --- e.g. is a unique order-isomorphism between $(A, <)$ and $(B,\prec)$. We need to show that there's at least one such function, and that there is at most one. How do we do the second bit? We show that if $f$ and $f'$ are candidates, then they are the same function. And how do we do that? We show that for every $a$ among the objects $A$, $f(a) = f'(a)$. But why does that show that $f$ and $f'$ are the same function?
It only does so on an extensional understanding of what a function is: we are taking it that functions aren't individuated by the rules we give for associating an argument with value but by the resulting association. So, even if we have two different rules of association, if they both generate the same collection of pairings between arguments and values, we count the rules as two different ways of presenting the same function.
Now this doesn't yet warrant defining functions as collections of argument/value pairings; that identification involves another idea beyond extensionality, call it plenitude. This is the further idea that any old association of arguments with values (one value per argument) determines a function, even if that association is beyond any possibility that we could describe it. It is one thing to say that different rules can determine the same function (extensionality), it is another thing to say that there can be functions which have no describable rule that determines their values (that functions are as plenitudinous as arbitrary argument/value pairings). Taking the second step might seem natural in hindsight, but its almost universal acceptance was the result of hard won achievements in 19th century mathematics.
OK: if we go for extensionality and plentitude, it becomes entirely natural to define a function from $A$ into $B$ -- or perhaps we should really say "model" or "implement" a function -- as a set of ordered pairs $(a, b)$ with only one pair for each $a$. That fixes functions as extensional items, and is naturally understood as making the functions as plenitudinous as the relevant sets.
Hence the characterization of functions we find in elementary analysis texts which implements functions as sets of ordered pairs in such a way that changing the co-domain doesn't change the function. That's because what matters in the elementary context is to emphasize an extensional understanding of what functions and to stress that you can have functions associated with no describable rule for associating argument to function.
Now sure, in further non-so-elementary contexts it can be useful to explicitly build into our characterization of a function the domain (if we are going to start seriously dealing with partial functions) and codomain. That refinement doesn't make the implementation in (some of) the elementary texts wrong -- that serves perfectly to make the points the elementary texts need to make.