Skip to content

Commit 0d3a86e

Browse files
authored
Merge pull request #202 from microsoft/legacy-review
Refine README.md content for clarity and precision in project objecti…
2 parents 9468ae4 + 464af98 commit 0d3a86e

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

Upgrading-Legacy-Projects/README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,36 @@
77
<a href="#learning-objectives">Learning Objectives</a>
88
</p>
99

10-
- **Who is this for**: Any technologist that is looking to apply AI pair-programming techniques with GitHub Copilot to perform challenging upgrade scenarios for legacy code.
11-
- **What you'll learn**: You'll use advanced GitHub Copilot techniques that are specifically useful when upgrading projects. These techniques and patterns can be applied to upgrading and revamping projects as well as developing from scratch.
12-
- **What you'll build**: A fully revamped Python project that used Python 2.5 using legacy and deprecated constructs into the latest version of Python 3 available.
10+
- **Who is this for**: Technologists who want to apply AI pair-programming techniques with GitHub Copilot to tackle challenging legacy code upgrade scenarios.
11+
- **What you'll learn**: Advanced Copilot prompting and interaction strategies specifically useful for upgrading and modernizing projects, with techniques that are also applicable to greenfield development.
12+
- **What you'll build**: A fully modernized Python project originally written in Python 2.5, upgraded from legacy and deprecated constructs to the latest version of Python 3.
1313

1414
## Requirements
1515

1616
1. Enable your [GitHub Copilot service](https://github.com/github-copilot/signup)
1717
1. Open [this repository with Codespaces](https://codespaces.new/microsoft/github-copilot-upgrading)
1818

19-
2019
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/github-copilot-upgrading)
2120

21+
💡 You don’t need Python installed locally. Codespaces includes everything you’ll need.
22+
2223
## Learning Objectives
2324

2425
In this workshop, you will:
2526

26-
- Use advanced GitHub Copilot interaction techniques to deal with a legacy project
27-
- Iterate, validate, and refine answers to upgrade the legacy project and validate its correctness
28-
- Apply generic concepts that can improve suggestions and select from different strategies that can yield better results.
29-
- Build a thorough testing strategy to help you identify potential issues and
30-
validate the project in its final state after upgrading.
27+
- Use advanced GitHub Copilot interaction techniques to handle legacy projects.
28+
- Iterate, validate, and refine AI-generated solutions to upgrade code correctly.
29+
- Apply general prompting strategies to improve Copilot suggestions.
30+
- Build and apply a testing strategy to validate the upgraded project.
31+
32+
Estimated completion time: 60–90 minutes
3133

3234
## :mega: Prerequisites
3335

34-
Before joining the workshop, there is only one prerequisite: you must have a public GitHub account. All resources, dependencies, and data are part of the repository itself. Make sure you have your GitHub Copilot license, trial, or the free version.
36+
You only need a public GitHub account. All dependencies and data are included in this repository.
37+
Make sure you have access to [GitHub Copilot](https://github.com/github-copilot/signup) (via license, trial, or free version).
3538

36-
## Main takeaways
39+
## Key Practices for Upgrading Legacy Projects
3740

3841
### 1. Define Clear Objectives and Requirements
3942

@@ -46,7 +49,7 @@ Start by understanding the end goal clearly. What is the result you're after? Fo
4649
Identify limitations or exclusions. For example, large language models (LLMs) can have (or lack) enough context to provide the right suggestions. It is up to you, the driver, to make decisions that achieve your goal. Certain business logic might prevent you from adding other external libraries or functionality. For example, if you are upgrading a project that is used in a production environment, you might not be able to add new libraries or functionality that could break the existing code.
4750

4851
> [!TIP]
49-
> Focus on being precise with the scope of the problem. If you're unsure, start broad and then progressively narrow down the details.
52+
> Start broad, then progressively narrow scope. Be precise about what success looks like.
5053
5154
### 2. Break Down the Problem into Components
5255

@@ -56,57 +59,57 @@ Decompose the problem into smaller, manageable pieces. For example, start with t
5659
- Tests, test setup and validation scripts
5760
- Configuration and installation process
5861

59-
Ensure you're applying each condition step-by-step. In programming, breaking down a complex function into smaller helper functions can make it easier to write and debug.
62+
Breaking down complexity makes debugging and validation easier.
6063

6164
> [!TIP]
62-
> Decomposition is a great way to deal with complexity, as it allows you to focus on one small task at a time.
65+
> Decomposition helps you focus on one small, solvable task at a time.
6366
6467
### 3. Create slices of work
6568

6669
A slice of work is a small, manageable piece of the overall problem. This is similar to breaking down the problem into components, but it focuses on the specific tasks that need to be completed. Think of this like a functional test that validates a specific feature or functionality. For example, if you're upgrading a legacy project, you might want to create a slice of work that focuses on upgrading a single library or function.
6770
This allows you to focus on one small task at a time, and it makes it easier to test and validate the changes.
6871

6972
> [!TIP]
70-
> When creating slices of work, thing about the functional testing so that you have an easy way to test the changes. This can be as simple as creating a test script that validates the changes or creating a test suite that runs all the tests in the project.
73+
> When creating slices, think about functional testing so you can easily validate changes.
7174
7275
### 4. Iterate and Refine the Solution
7376
Start simple, then refine. In complex problems, initial attempts are rarely perfect. Start by generating a basic solution and progressively build on it.
7477

7578

7679
> [!TIP]
77-
> With every iteration, test and verify against expected outcomes to ensure the result is moving in the right direction.
80+
> With each iteration, run tests and compare outcomes against expectations.
7881
7982
### 5. Use Examples to Clarify Requirements
8083
When creating prompts for AI models or explaining problems, provide examples. An example can illustrate your expectations, making the task clearer for anyone or anything (including tools like GitHub Copilot) involved in solving the problem.
8184

8285
For instance, with legacy code, you could explain what the inputs and expected outputs can be while including the logic to accomplish the task
8386

8487
> [!TIP]
85-
> Example-driven problem-solving helps align understanding. It's especially useful for ambiguous tasks.
88+
> Example-driven problem-solving is especially effective for ambiguous tasks.
8689
8790
### 6. Identify Patterns and Reuse Solutions
8891
Recognize common patterns in your problem and reuse solutions where applicable. An obvious example of this in legacy Python projects is the use of exception handling in Python 2.5 would create a `SyntaxError` in Python 3+.
8992

9093
Sometimes in legacy projects it is common to create functions that handle either case or even modules that can do imports depending on the Python version. This is a common pattern in legacy projects that can be reused in other projects.
9194

9295
> [!TIP]
93-
> Recognizing patterns is a hallmark of experience. As you encounter similar problems repeatedly, you'll start to see similarities that can speed up your process.
96+
> Recognizing patterns helps speed up future upgrades.
9497
9598
### 7. Use Constraints and Edge Cases for Robustness
96-
Think about edge cases and exceptions. Complex problems often involve handling not just the "ideal" data, but also the "edge" or "outlier" cases that might break a naive solution. Ensure that your prompt or solution accounts for these edge cases.
99+
Consider edge cases and exceptions. Complex problems rarely involve only 'ideal' inputs—outliers and unusual scenarios can break simple solutions. Make sure your prompt or implementation anticipates and handles these cases.
97100

98101
In legacy code, this might mean considering how the code behaves with unexpected inputs, which would guide you to write new tests or modify existing ones.
99102

100103
> [!TIP]
101-
> Thinking through edge cases helps you build more resilient, generalized solutions. Always put an added emphasis in testing and creating a robust test suite to validate your changes.
104+
> Emphasize building a comprehensive test suite to validate changes.
102105
103106
### 8. Use Tools Effectively
104107
Whether you’re using GitHub Copilot, your editor auto-completion, or another form of automation, leverage the tools at your disposal but make sure you're guiding them with the right context. Tools are great for speeding up the generation, but they still need well-structured inputs and validation from you.
105108

106109
For GitHub Copilot, ensure that your prompts are detailed, but concise. Tools often work best when given structured input that leaves little ambiguity.
107110

108111
> [!TIP]
109-
> Be specific with your tools, but also check results, as tools might not always fully understand context unless properly guided.
112+
> Guide your tools with context and always verify their output.
110113
111114

112115
### 9. Test and Validate
@@ -115,23 +118,20 @@ Testing and validation are key to ensuring that your solution works as expected.
115118
Testing ensures that both the expected and unexpected situations are handled correctly.
116119

117120
> [!TIP]
118-
> Always have a validation step built into your process to catch mistakes early.
119-
120-
Generalization for Other Use Cases:
121-
For writing code or algorithms: The same concepts apply when generating functions, classes, or workflows. Clearly define input, expected output, edge cases, and iterate to refine.
122-
123-
For AI model prompts: When asking for something complex (like generating code, text, or designs), give clear objectives, break down the problem, provide context, and iterate.
124-
125-
For design or content generation: Define the purpose, break down design elements, and provide examples or inspiration, then refine based on feedback.
126-
127-
Final Thoughts:
128-
Complex generation problems often involve a balance of clarity, decomposition, iteration, and validation. Whether it's an SQL query or any other task, keeping these concepts in mind will allow you to generate more accurate, efficient, and reliable results.
121+
> Always include a validation step to catch mistakes early.
129122
123+
**Generalization for Other Use Cases:**
124+
These principles apply to a wide range of scenarios:
125+
- _Coding & algorithms:_ Define inputs, outputs, and edge cases, then iterate.
126+
- _AI prompting:_ Break down tasks, provide context, and refine results.
127+
- _Design & content:_ Define purpose, provide examples, refine based on feedback.
130128

129+
**Final Thoughts:**
130+
Tackling complex generation tasks requires a balance of clarity, decomposition, iteration, and validation. Whether you're writing an SQL query or solving another challenge, applying these principles helps produce results that are more accurate, efficient, and reliable.
131131

132132
## :books: Resources
133133

134-
Although not required, some of the features this workshop covers are in these Microsoft Learning modules:
134+
Although not required, some of the features this workshop covers are in these Microsoft Learn modules:
135135

136136
- [Code with GitHub Codespaces](https://learn.microsoft.com/training/modules/code-with-github-codespaces/)
137137
- [Using advanced GitHub Copilot features](https://learn.microsoft.com/training/modules/advanced-github-copilot/)

0 commit comments

Comments
 (0)