{
    "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable",
    "locale": "en",
    "title": "Extract Method / Variable: Knowledge hub | DeLaParra Services",
    "description": "Pull selected code out into its own method or variable. A JetBrains staple of clean refactoring.",
    "alternates": {
        "en": "https://delaparra-services.nl/knowledge-hub/extract-method-variable",
        "nl": "https://delaparra-services.nl/nl/kennisbank/extract-method-variable"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.csv",
        "md": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.md",
        "json": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.json",
        "zip": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.zip",
        "pdf": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.csv",
            "encodingFormat": "text/csv",
            "name": "extract-method-variable.csv"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.json",
            "encodingFormat": "application/json",
            "name": "extract-method-variable.json"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.md",
            "encodingFormat": "text/markdown",
            "name": "extract-method-variable.md"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.pdf",
            "encodingFormat": "application/pdf",
            "name": "extract-method-variable.pdf"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.zip",
            "encodingFormat": "application/zip",
            "name": "extract-method-variable.zip"
        }
    ],
    "markdown": "1. [Home](<https://delaparra-services.nl/>) \n1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) \n1. [Extract Method / Variable](<https://delaparra-services.nl/knowledge-hub/extract-method-variable>)\n\n  \n\nCategory: Keyboard shortcuts \n\n# Extract Method / Variable\n\n  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    \n\n## What is Extract Method / Variable?\n\n \n\nExtract Method / Variable: Pull selected code out into its own method or variable. A JetBrains staple of clean refactoring. Extract method and extract variable are refactorings your IDE can do for you. Select a piece of code, choose extract, and the editor moves it into a new method or variable with a name you choose, updating the original code to use it.\n\n \n\nDefinition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)\n\n \n\n## Frequently asked questions about Extract Method / Variable\n\n  \n\n### How is Extract Method / Variable used in practice?\n\n \n\nIn JetBrains IDEs the shortcuts are ` Ctrl+Alt+M ` for a method and ` Ctrl+Alt+V ` for a variable, or ` Cmd+Option+M ` and ` Cmd+Option+V ` on a Mac. VS Code offers them through the light bulb menu.\n\n    \n\n### What should you keep in mind with Extract Method / Variable?\n\n \n\nThis is one of the simplest ways to make code readable. A condition like ` if ($order->paid_at && !$order->shipped_at && $order->total > 0) ` becomes ` if ($order->isReadyToShip()) `. Because the IDE does the edit, it handles variables and return values correctly, which makes small improvements safe to do while you work.\n\n \n\n## At a glance\n\n   CategoryKeyboard shortcuts Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026\n\n \n\n## More Keyboard shortcuts terms\n\n \n\n- [dd (delete line)](<https://delaparra-services.nl/knowledge-hub/dd-delete-line>) \n- [Delete Line](<https://delaparra-services.nl/knowledge-hub/delete-line>) \n- [Delete Previous Word](<https://delaparra-services.nl/knowledge-hub/delete-previous-word>) \n- [Format Document](<https://delaparra-services.nl/knowledge-hub/format-document>) \n- [gg / G (top / bottom)](<https://delaparra-services.nl/knowledge-hub/gg-g-top-bottom>) \n- [Go to Definition](<https://delaparra-services.nl/knowledge-hub/go-to-definition>)\n\n \n\n[All terms starting with E](<https://delaparra-services.nl/knowledge-hub#letter-e>)\n\n \n\n## Skills\n\n \n\n- ### Editor shortcuts (VS Code / Cursor and Vim)\n\n \n\nUse when a user asks how to do something faster in VS Code (or Cursor) or Vim, asks what a keyboard shortcut does (e.g. Ctrl+D, Ctrl+Shift+P, F12, gg, dd, yy, ciw, :wq), wants to customise keybindings, or is stuck in Vim. Gives the correct shortcut for their operating system and can write keybindings.json entries.\n\n [View skill](<https://delaparra-services.nl/skills/editor-shortcuts>) [Download zip](<https://delaparra-services.nl/skills/editor-shortcuts/download>)\n\n \n\n## Manuals\n\n \n\n- [Keyboard shortcuts in VS Code and the terminal](<https://delaparra-services.nl/manuals/sneltoetsen-in-vs-code>) \n- [Installing Visual Studio Code](<https://delaparra-services.nl/manuals/visual-studio-code-installeren>)\n\n \n\n## Need any help?\n\n \n\nStuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.\n\n  [Get in touch](<https://delaparra-services.nl/availability>)\n\n[HTML version](https://delaparra-services.nl/knowledge-hub/extract-method-variable)\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Organization",
                "@id": "https://delaparra-services.nl/#practice",
                "logo": "https://delaparra-services.nl/logo.png",
                "name": "DeLaParra Services",
                "legalName": "DeLaParra Services",
                "url": "https://delaparra-services.nl/",
                "description": "Bespoke software, web applications and mobile apps, developed in Laravel by a single developer in Groningen. Fixed price agreed in advance, full source code provided upon delivery.",
                "email": "info@delaparra-services.nl",
                "address": {
                    "@type": "PostalAddress",
                    "addressLocality": "Groningen",
                    "addressRegion": "Groningen",
                    "addressCountry": "NL"
                },
                "areaServed": "Groningen, the Netherlands",
                "knowsLanguage": [
                    "en",
                    "nl"
                ],
                "knowsAbout": [
                    "Web design and development",
                    "App development",
                    "Custom software and web applications",
                    "OpenSpec",
                    "AI code review",
                    "Your own coding agent"
                ],
                "founder": {
                    "@id": "https://delaparra-services.nl/#person"
                }
            },
            {
                "@type": "FAQPage",
                "@id": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#webpage",
                "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable",
                "name": "Extract Method / Variable: Knowledge hub | DeLaParra Services",
                "description": "Pull selected code out into its own method or variable. A JetBrains staple of clean refactoring.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@type": "DefinedTerm",
                    "@id": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#term",
                    "name": "Extract Method / Variable",
                    "description": "Pull selected code out into its own method or variable. A JetBrains staple of clean refactoring.",
                    "termCode": "extract-method-variable",
                    "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable",
                    "inLanguage": "en",
                    "keywords": "Keyboard shortcuts",
                    "dateModified": "2026-11-25T17:46:26+00:00",
                    "inDefinedTermSet": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#terms"
                    },
                    "isPartOf": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#dataset"
                    },
                    "subjectOf": [
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#webpage"
                        },
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#dataset"
                        }
                    ]
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#breadcrumb"
                },
                "mainEntity": [
                    {
                        "@type": "Question",
                        "name": "What is Extract Method / Variable?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Pull selected code out into its own method or variable. A JetBrains staple of clean refactoring. Extract method and extract variable are refactorings your IDE can do for you. Select a piece of code, choose extract, and the editor moves it into a new method or variable with a name you choose, updating the original code to use it."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "How is Extract Method / Variable used in practice?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "In JetBrains IDEs the shortcuts are Ctrl+Alt+M for a method and Ctrl+Alt+V for a variable, or Cmd+Option+M and Cmd+Option+V on a Mac. VS Code offers them through the light bulb menu."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What should you keep in mind with Extract Method / Variable?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "This is one of the simplest ways to make code readable. A condition like if ($order->paid_at && !$order->shipped_at && $order->total > 0) becomes if ($order->isReadyToShip()). Because the IDE does the edit, it handles variables and return values correctly, which makes small improvements safe to do while you work."
                        }
                    }
                ],
                "author": {
                    "@id": "https://delaparra-services.nl/#person"
                },
                "mentions": [
                    {
                        "@id": "https://delaparra-services.nl/skills/editor-shortcuts#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/manuals/sneltoetsen-in-vs-code#article"
                    },
                    {
                        "@id": "https://delaparra-services.nl/manuals/visual-studio-code-installeren#article"
                    }
                ]
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Knowledge hub",
                        "item": "https://delaparra-services.nl/knowledge-hub"
                    },
                    {
                        "@type": "ListItem",
                        "position": 3,
                        "name": "Extract Method / Variable"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#dataset",
                "name": "Extract Method / Variable",
                "description": "Pull selected code out into its own method or variable. A JetBrains staple of clean refactoring.",
                "url": "https://delaparra-services.nl/knowledge-hub/extract-method-variable",
                "identifier": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/extract-method-variable#term"
                },
                "creator": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://creativecommons.org/licenses/by/4.0/",
                "creditText": "Coders Lingo (https://coderslingo.com/resources/open-dataset/), CC BY 4.0",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "keywords": "Keyboard shortcuts",
                "version": "2026-11-25",
                "dateModified": "2026-11-25T17:46:26+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#dataset",
                    "name": "IT terms from A to Z",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "extract-method-variable.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:26+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "extract-method-variable.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:26+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "extract-method-variable.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:26+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "extract-method-variable.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:26+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "extract-method-variable.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/extract-method-variable.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:26+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    }
                ]
            }
        ]
    }
}