Good analogies between types in programming and structures, spaces and fields in mathematics? I am a programmer, and so my knowledge of math is limited to bare-bones calculus, linear algebra etc. Basically I know how to do the basic stuff, but never learned how to look at it in a more abstract sense.
I am trying to see if I can leverage my understanding of concept within programming to get a better intuition about concepts in mathematics. I am well aware that there is no 1-to-1 mapping. So I am not looking for precise analogies but very rough analogies to help me build some intuition and make my journey into math-world a bit easier.
In programming we operate with hierarchies of types, some which are abstract and others which are concrete. Concrete types can be instantiated to create objects. We can do thing with objects based on the type they belong to. So if I have an abstract type A, which concrete subtypes B and C, then instances of B and C will have some shared abilities because they share an abstract type A.
I am trying to map this thinking into my math reading. In programming there is often a base type for everything called e.g. Object or Any. It seems you have the same in math. Everything is a mathematical object.
In many programming languages types are also objects themselves. There seems to be an analogy in mathematics. mathematical structures look like types to me. As a programmer I would say these have mathematical objects as instances. However the mathematical structure is itself also an object, just like a type can be an object in programming.
And like programming there is a type hierarchy. If I understand correctly an algebraic structure is kind of like a subtype of refinement of the mathematical structure concept.
When I look at things like fields and spaces this reminds of parameterized types in programming. E.g. Vector2D{Integer} or Vector2D<Int> depending on the language you use are 2D vectors parameterized on the Integer type, meaning their x and y coordinates are integers, rather than say floating point.
As far as I understand you express vector spaces in a similar fashion. You say a vector space over some field. The field seem a bit analogous to a type parameter to me. The field would be the natural numbers, real numbers of whatever. The field defines the components making up the  individual vectors in the vector space as well as the numbers which you may multiply a vector with e.g.
Again I know these kinds of analogies are flawed, but if we where to attempt to create analogies, is there some truth to what I am guessing here or do I have a profound misunderstanding of these concepts?
 A: I like the analogies. While I agree that there is not necessarily any perfect 1-1 mapping of the ideas of CS to those of algebra or linear algebra, analogies can certainly help in building intuition. For instance, I had a tough time "picturing" the hierarchy of rings, integral domains, principal ideal domains, unique factorization domains, euclidean domains, etc... The inclusion diagrams made sense, but I didn't feel like I understood it concretely. (Of course, one could always respond with the famous von Neumann quote, "...in mathematics, you don't understand things. You just get used to them.") The best I could do, having a background in CS, was imagine some class inheritance scheme where the level of an object in the hierarchy dictated how much the class was able to do, so to speak. The more defined the class was, the more tasks it was able to complete. A ring, for instance, has plenty of nice structure (we can add commutatively and multiply in a closed set), but not as much a Euclidean domain (where we can run Euclidean algorithms).  
Your intuitions about parametrized types for vector spaces over a field $\mathbb{F}$ is a good example. Depending on the field that you assign (e.g. the reals, number fields, finite fields, $p$-adic fields), the vectors may behave differently under linear transformations. 
Consider doing some online research on category theory. This field deals with the interaction of classes of algebraic objects via mappings. I've often seen interesting interactions between computer science and category theory and it might help build further intuitions. Good luck! 
A: While this question is itself pretty open-ended, I'd like to make the suggestion of picking up and diving into the code of your favorite symbolic math manipulation library. Examples for the same would be SymEngine for C++, SymPy for Python, certain libraries that are a part of the Julia language and so on.
A number of these packages make use of OOPS paradigm in modelling relationships between different abstract concepts. For example, you'd have Integers inheriting from Rationals, which in turn would be inheriting from Reals. Then further on, you'd have specific classes for Polynomials, Rings and Fields.
Factoring those polynomials would make use of Galois Field Theory and other approaches. In between inherited classes, you'll observe the intelligent use of functional overloading to simplify certain expressions, or derive meaningful computations. As you rightly mentioned the use of types, a number of these libraries expose mathematical constructs as types through template metaprograming as well (for C++ based libraries atleast).
All of these ideas have been modeled considering different philosophies in different packages, pivoting to one would be a personal choice to be honest. Nonetheless, each philosophy attempts to model different aspects of the connections that these abstracts constructs share, using well known programming design principles. Hope this helps, happy learning.
