Integrating ChatGPT-4 Into Your Development Process
ChatGPT has taken the tech world by storm with the usual, perhaps warranted in this case, hype. One prediction is that major tasks normally associated with highly trained humans like lawyers, doctors and programmers will be performed by this class of intelligence emulators. My exploration into the capabilities of ChatGPT and in particular ChatGPT-4 have convinced me that… not quite yet!
However, it has also convinced me that, as a powerful research and programming assistant, ChatGPT excels in three main areas where every other search tools fail miserably.
First: ChatGPT’s native language capabilities means that it ‘understands’ the questions that you are asking so it can respond with a narrowly focused answer. No more tedious searches for that one flower of knowledge in the weed filled garden of that is the Web! Ask a precise question and ChatGPT will give you a precise answer. If your question is not specific enough as indicated by the response: edit it and ask again. The answer will get more focused as you nail down your requirements.
Second: ChatGPT’s ability to follow the application development process as one continuous conversation from initial requirements through UML architecture, coding, deployment and full round trip model updates means that refinements can be easily applied without error prone manual intervention. It can track the evolution of the product as requirements change or testing exposes issues requiring model updates.
Third: ChatGPT is a pretty good full stack coder when given explicit instructions! A model can be created in UML then coded into an Angular/Material Application, a Java REST service, a SQL update script and a Docker deployment all based on conversational input. The responses are in code snippet form so there is some cut and paste involved, although ChatGPT can wrap the response in a Linux 'echo' shell script to create multiple individual files.
For this blog we will be starting a simple project called Brainstorm. We will be assuming several roles as is typical of a medium complexity project, starting with Project Manager, Software Architect, Backend and UI Developers and Devops Engineer Devops. The process will proceed as one conversation with ChatGPT using typical Scrum ‘story’ form.
Prerequisites
This Blog assumes you are familiar with the Agile software development process as followed by Scrum practitioners and have some background in the technologies around Enterprise Application Development using typical tools of the trade: Java/SpringBoot, Angular/Material, SQL database and Docker. It also assumes that you use an IDE to like VSCode or IntelliJ to develop and run application code.
Getting Started
The first and only setup step, as of this writing is to get a ‘Research Account’ with OpenAI to use to interact with ChatGPT-4.
Start the Conversation
Assuming that we have a ChatGPT-4 Research Account and have the browser open to the request page we will start the conversation by introducing ourself as the Project Manager starting the project. A typical introductory conversation would be:
Request (Project Manager):
As Ken the Project Manager I will be managing a Software Development Project called 'Brainstorm'.
This will be a Web and Mobile Application for capturing Ideas from Users
and promoting the winning Ideas based on Users' votes.
The Votes will be tabulated and displayed after a Voting Session.
Response (ChatGPT):
That sounds like an exciting project, Ken! As the project manager for the "Brainstorm" software development project, you have an important role in ensuring its successful completion. Here are some key steps and considerations you may want to keep in mind:
Remember, successful project management involves careful planning, effective coordination, and continuous evaluation. By following these steps and adapting to any challenges along the way, you can increase the likelihood of a successful outcome for the "Brainstorm" project. Good luck!
Comment:
As we can see the response is an accurate description of a software project with specific details that we put in our request like the name of the project and the technologies however it is somewhat general in nature. To get more specifics we will jump to step 6 assuming that we have spent a working retreat week in Bali to get the project kicked off :)
Start the Project and Move Forward
Request:
Ken here. I have completed steps 1 through 5 and have the team together.
Chris will be doing the Software Architecture
Philip will be designing and coding the Angular app
Ashley will be coding the Java service
Scott will be doing the Devops
We will be using Jira/Kanban for project management
Response:
Great progress, Ken! It's good to hear that you've completed the initial steps and have your team in place. Here are some further considerations based on the roles you've assigned and the tools you plan to use:
In addition to these considerations, encourage regular communication and collaboration among team members. Conduct daily stand-up meetings to discuss progress, address any challenges, and provide support to team members. Foster a culture of continuous improvement and knowledge sharing within the team.
By leveraging the strengths of each team member and utilizing the project management tools effectively, you'll be well-positioned to drive the "Brainstorm" project towards success. Keep up the good work, Ken!
Comment:
Again somewhat general although ChatGPT provided more specifics on the Software Architecture step. It is time to hand it over to Chris the Software Architect. At this point ChatGPT does not support collaborative conversations so for the sake of this exercise we will use the same conversation to continue the process.
Request (Chris):
Chris here, I have studied the requirements and have decided on the following technologies for the Brainstorm application:
PlantUML for UML design
Java/SpringBoot for backend services
Postgres database
Angular/Material UI
Docker compose deployment.
Response:
Hi Chris! It's great to hear that you have studied the requirements and made decisions regarding the technologies for the Brainstorm application. Your chosen tech stack looks solid. Here are some considerations for each technology:
Remember to document the configuration and setup instructions for each technology to facilitate smooth onboarding and future maintenance. Encourage collaboration and knowledge sharing among the team members to ensure everyone is familiar with the chosen technologies.
By leveraging these technologies effectively, you can build a scalable, maintainable, and user-friendly Brainstorm application. Best of luck, Chris, and I'm here to assist if you have any further questions!
Get Down To Details
Because I am feeling lazy today I will ask ChatGPT to do my job as Architect and hopefully take an early lunch :)
Request
Chris here, I need a plant UML class diagram for the Brainstorm application.
Response:
Certainly, Chris! Here's a sample PlantUML class diagram for the Brainstorm application:
@startum
class User {
- id: int
- username: string
- email: string
- password: string
- createdAt: datetime
- updatedAt: datetime
+ getIdeas(): Idea[]
+ getVotes(): Vote[]
+ createIdea(title: string, description: string): Idea
+ voteForIdea(idea: Idea): void
}
class Idea {
- id: int
- title: string
- description: string
- createdAt: datetime
- updatedAt: datetime
+ getAuthor(): User
+ getVotes(): Vote[]
+ addVote(vote: Vote): void
}
class Vote {
- id: int
- user: User
- idea: Idea
}
class VoteSession {
- id: int
- startDate: datetime
- endDate: datetime
- isOpen: bool
- winningIdeas: Idea[]
+ open(): void
+ close(): void
+ tabulateVotes(): void
+ addIdeaToWinners(idea: Idea): void
}
class Notification {
- id: int
- message: string
- createdAt: datetime
+ sendToUser(user: User): void
}
class Database {
- connection: string
+ saveUser(user: User): void
+ saveIdea(idea: Idea): void
+ saveVote(vote: Vote): void
+ getUsers(): User[]
+ getIdeas(): Idea[]
+ getVotes(): Vote[]
}
User "1" --> "0..*" Idea
User "1" --> "0..*" Vote
Idea "1" --> "0..*" Vote
VoteSession "1" --> "0..*" Idea
Vote "1" --> "0..1" User
Vote "1" --> "0..1" Idea
User "1" --> "0..*" Notification
Database "1" --> "0..*" User
Database "1" --> "0..*" Idea
Database "1" --> "0..*" Vote
@endumll
Comments
Not a bad guess at the model based on the first conversation with Ken but I don’t think I will be taking an early lunch. Several issues jump out at me:
UML Refinement
We will provide some more specific detail to narrow the response down. Editing the request and resubmitting generally works best rather than just submitting a new, slightly changed, one which can get ChatGPT confused and frustrated.
Edited Request:
Chris here, I need a plant UML class diagram for the Brainstorm application.
Name the diagram 'Brainstorm UML Model'
Use the package 'com.brainstorm'.
Create the classes with attributes - no methods.
The model will include a base class called BaseEntity with UUID for id and typical attributes.
Other classes, with typical attributes include: User, Vote, Idea and VotingSession. Create the relationship links based on:
Voting session has Ideas, startTime and endTime
Ideas have Votes
Votes have Users
Add the inheritance notation for all classes.
Recommended by LinkedIn
Response:
Certainly, Chris! Here's a PlantUML class diagram for the Brainstorm application, incorporating the classes you mentioned along with their attributes and the specified relationships:
@startuml BrainstormUMLMode
package com.brainstorm {
abstract class BaseEntity {
+id: UUID
+createdAt: LocalDateTime
+updatedAt: LocalDateTime
}
class User {
+firstName: String
+lastName: String
+email: String
+password: String
}
class Vote {
+user: User
+voteCount: int
}
class Idea {
+title: String
+description: String
+creator: User
+votes: List<Vote>
}
class VotingSession {
+ideas: List<Idea>
+startTime: LocalDateTime
+endTime: LocalDateTime
}
VotingSession -- "1..*" Idea
Idea "1..*" -- "0..*" Vote
Vote "1" -- "0..1" User
BaseEntity <|-- User
BaseEntity <|-- Vote
BaseEntity <|-- Idea
BaseEntity <|-- VotingSession
}
@endumll
In this diagram, the BaseEntity class serves as the base class for other classes, providing common attributes such as id, createdAt, and updatedAt. The User class represents users of the application, with attributes like firstName, lastName, email, and password. The Vote class represents individual votes and includes the user who cast the vote and the voteCount. The Idea class represents ideas submitted by users, including attributes like title, description, creator, and a list of associated votes. The VotingSession class represents a session in which voting takes place and includes attributes such as ideas, startTime, and endTime.
The relationships are represented using association lines. The VotingSession has a one-to-many relationship with Idea, as indicated by the "1..*" multiplicity on the VotingSession end and no multiplicity on the Idea end. The Idea class has a one-to-many relationship with Vote, indicating that an idea can have multiple votes. Finally, the Vote class has a one-to-one relationship with User, as indicated by the "0..1" multiplicity on the Vote end and no multiplicity on the User end.
I've also added the inheritance notation with the <|-- symbol to show that all the classes inherit from the BaseEntity class.
Please note that this diagram represents the class structure and relationships as you specified, but it does not include any methods. Let me know if you need any further assistance or if you have any additional requirements!
Render and Review Your Model
PlantUML was chosen as the UML technology because ChatGPT seems to understand it, probably because it is text based and concise. To render your diagram use the on-line rendering tools at: PlantUML Web Server. Simply copy/paste the above PlantUml definition into the text area and hit Submit. You should see your UML diagram:
If you need to keep things internal you can run the PlantUML docker image locally and use the VSCode PlantUML plugin to automatically render your UML diagram - just ask ChatGPT and follow the instructions:
Request
As Architect I need to run the PlantUML service using docker-compose while editing and viewing diagrams using VSCode.
Manual Refinement
Assuming that we are using VSCode and the PlantUML extension or the online tool we can edit the class diagram and view the model changes as they are made. Once we have presented and reviewed the model with the team we will let ChatGPT know that there is an updated diagram so that that will become the basis for downstream developments.
Request
I have updated the model as follows:
@startuml BrainstormUMLModel
skinparam groupInheritance 2
package com.brainstorm {
abstract class BaseEntity {
+id: UUID
+createdAt: DateTime
+updatedAt: DateTime
}
class User {
+firstName: String
+lastName: String
+email: String
+password: String
}
class Vote {
+user: User
+voteCount: int
}
class Idea {
+title: String
+description: String
+creator: User
+votes: List<Vote>
}
class VotingSession {
+name: String
+ description: String
+ideas: List<Idea>
+startTime: DateTime
+endTime: DateTime
}
VotingSession o--> "1..*" Idea
Idea "1..*"*--> "0..*" Vote
Vote "1" o--> "0..1" User
BaseEntity <|-- User
BaseEntity <|-- Vote
BaseEntity <|-- Idea
BaseEntity <|-- VotingSession
}
@enduml
Lets keep that and name it 'Brainstorm UML Model'
Response:
Certainly, Chris! Here's the updated PlantUML class diagram for the Brainstorm UML Model, with the modifications you specified:
@startuml BrainstormUMLMode
title Brainstorm UML Model
skinparam groupInheritance 2
package com.brainstorm {
abstract class BaseEntity {
+id: UUID
+createdAt: DateTime
+updatedAt: DateTime
}
class User {
+firstName: String
+lastName: String
+email: String
+password: String
}
class Vote {
+user: User
+voteCount: int
}
class Idea {
+title: String
+description: String
+creator: User
+votes: List<Vote>
}
class VotingSession {
+name: String
+description: String
+ideas: List<Idea>
+startTime: DateTime
+endTime: DateTime
}
VotingSession o--> "1..*" Idea
Idea "1..*"*--> "0..*" Vote
Vote "1" o--> "0..1" User
BaseEntity <|-- User
BaseEntity <|-- Vote
BaseEntity <|-- Idea
BaseEntity <|-- VotingSession
}
@endumll
I have renamed the diagram to "Brainstorm UML Model" as requested. The modifications include adding the name attribute to the VotingSession class and the description attribute to both VotingSession and Idea classes. The relationship links and inheritance notations remain the same as before.
Please let me know if there is anything else I can assist you with!
Summary
The requirements description was detailed enough to create a model sufficient to move on to creating a POC application. Using the Scrum ‘story’ form in our requests has the advantage that it can be understood and approved by none-technical stakeholders. The advantage for Chris the Architect is that he can work at an abstract level and not have to deal with the syntactical minutia of the design language… in this case PlantUML.
The UML diagram will be used to generate the database create script, the SpringBoot service and the Angular UI in future posts.
Next Steps
Check back for the following posts: