AI-Powered Developer: Build software with ChatGPT and Copilot cover
welcome to this free extract from
an online version of the Manning book.
to read more
or

4 Building software with GitHub Copilot

This chapter covers

  • Developing the core of our system using Copilot
  • Refactoring to apply patterns
  • Integrating hexagonal architecture
  • Incorporating event-driven principles

In the last chapter, we used ChatGPT to help us design our information technology asset management (ITAM) system. Now, with the design firmly in hand, we begin to build out this application, starting with the domain model. The domain model is the core of our system. It represents the classes that will be applying and enforcing our business rules. We will use GitHub Copilot extensively in this chapter. The most important takeaway from this chapter is that using a large language model (LLM) helps to illuminate the unknown unknowns: that is, the non-obvious, the arcane, or the hidden complexity in the systems that we build. It makes the hard things easier and the seemingly impossible, possible.

One additional note: this chapter is code-heavy. Your code almost certainly will not exactly match the code presented in this chapter. Instead of dwelling on this fact, accept it. Try to understand why these differences exist. Observe if altering your prompt modifies the result, and if it does, in what ways.

4.1 Laying the foundation

4.1.1 Expressing our domain model

4.1.2 Favoring immutability

4.1.3 Decorating our favorite classes

4.1.4 Adapting a strategy for depreciation

4.2 Weaving patterns, patterns, patterns

4.2.1 Paying a visit to our department

4.2.2 Creating objects in a factory (pattern)

4.2.3 Instructing the system on how to build

4.2.4 Observing changes

4.3 Plugging in ports and adapters

4.3.1 Hexagonal architecture in review

4.3.2 Driving our application

4.3.3 Accessing our data and persisting our changes

4.3.4 Centralizing (and externalizing) our data access

Summary