Sollicitatievraag bij SEB AB

when would I consider abstracting code to its own method/pattern