In coding theory, the problem of finding the shortest linear codes for a fixed set of parameters is central. Given the dimension k, the minimum weight d, and the order q of the finite field Fq over which the code is defined, the function nq(k, d) specifies the smallest length n for which an [n, k, d]q code exists. The problem of determining the values of this function is known as the problem of optimal linear codes. Using the geometric methods through projective geometry, we determine nq(4, d) for some values of d by constructing new codes and by proving the nonexistence of linear codes with certain parameters.