Q:

Simple question about variables into functions

Im trying to write a very simple code that will solve an equation.
total = 800;
side1 = x;
side2 = total - 2 x;
f[x_] := side1*side2
f[x]
f'[x]
Solve[f'[x]==0]

But what seems to be happening is that f[x] is the equation i want it to be, but it thinks the derivative is zero, which is not the case and im not sure how im messing this up. 
Thank you for any advice. 

A:

total = 800;
side1 = x;
side2 = total - 2 x;
f[x_] = side1*side2;
Solve[f'[x] == 0, x]
(* {{x -> 200}} *)

or
total = 800;
side1[x_] = x;
side2[x_] = total - 2 x;
f[x_] := side1[x]*side2[x];
Solve[f'[x] == 0, x]
(* {{x -> 200}} *)

