He was elected to the California State Assembly from Amador County at the age of 25 as a member of the Whig Party. At the time, only five years after California had become a state and in accordance with the original Constitution of California, members of the assembly were chosen annually. Farley ran for re-election in 1855, this time as a member of the Know Nothing Party, which was in the majority of the legislature at the time. He again shifted allegiances to the Democratic Party following the collapse of the Know Nothing Party, remaining with the strong political contingent in the assembly and was elected to be Speaker of the Assembly in 1856.
