The advantage of the gym is that machines usually (but not always) force or at least guide the correct form. Free weights and free exercise leave so much room for a wrong form and building up to injuries.