Generative AI in Software Development

Increase your productivity in software development with Generative AI

Xin Cheng
12 min readApr 4, 2023

As I mentioned in Generative AI use case article, we are seeing AI-assisted developers. I include some reference for this field in that article, but as time goes by, it is necessary to dedicate a particular article to survey this field in-depth.

SDLC stages

Let’s review software development lifecycle first. A typical SDLC has following stages:

Stage1: Planning and requirement analysis, defining Requirements

Gather requirement from end customer. which is used to plan the basic project approach and to conduct product feasibility study in the economical, operational and technical areas. Then software development phases are planned to deliver the software. Functional and non-functional requirements need to be documented clearly, which architecture design will be based on and support.

Stage2: Designing software

Architectural modules of the product will be reviewed by stakeholders to support the customer requirements.

Stage3: Developing software

The product (imagine product is a suite of custom code generated, supporting infrastructure and other related artifacts) is implemented, either with programming or low-code solution.

Stage4: Testing

Lots of testing need to be performed: some done by developers (e.g, unit test), some done by quality assurance (e.g. functional testing, integration testing, load testing), and usually user acceptance testing is needed before the product is formally considered as feature-complete.

Stage5: Deployment

The product needs to be deployed into production, either manually or in modern CICD way.

Stage6: Maintenance

The product needs to support user access and new feature enhancement, and someone needs to make sure that the product continues to function. When user has questions regarding the software, some support is needed to satisfy customer needs.

Overall Generative AI in SDLC

Here is how Generative AI can help in SDLC stages (we may see more use cases as Generative AI matures). Overall, we want to treat Generative AI as senior developer/architect with more accessibility.

They are pretty self-explanatory to a software developer. Currently more focus is at development/testing stage, but there is also some early experimentation in other stage, where I will include reference.

Basic programming tasks can at least be prepared, I am seeing the trend of AI-assisted developers. Here are some articles 1, 2, 3.

Advise on getting started on topics

  1. Recommend get started materials
  2. Explain an implementation
  3. Explain general concepts in specific industry domain (e.g. fleet management)

Productivity

  1. Generate and Explain Linux Bash, Python, Java, JavaScript, TypeScript, SQL, Git, Terraform, Dockerfile code (as well as HTML, CSS), also UML, documentation on using API code it generates
  2. Convert code from one language to another
  3. Boilerplate code generator
  4. Detect code vulnerabilities
  5. Improve code quality and enforce good practices
  6. Generate unit tests for your scripts
  7. Generate training/sample data for your ML projects

Requirements gathering: ChatGPT can significantly simplify the requirements gathering phase by building quick prototypes of complex applications. It also can minimize the risks of miscommunication in the process since the analyst and customer can align on the prototype before proceeding to the build phase

Design: DALL-E, another deep learning model developed by OpenAI to generate digital images from natural language descriptions, can contribute to the design of applications. In addition to providing user interface (UI) templates for common use cases, it also may eventually be deployed to ensure that the design of a given application meets regulatory criteria such as accessibility

Build: ChatGPT has the capability to generate code in different languages. It could be used to supplement developers by writing small components of code, thus enhancing the productivity of developers and software quality. It even can enable citizen developers to write code without the knowledge of programming language

Test: ChatGPT has a major role in the testing phase. It can be used to generate various test cases and to test the application just by giving prompts in natural language. It can be leveraged to fix any vulnerabilities that could be identified through processes such as Dynamic Code Analysis (DCA) and perform chaos testing to simulate worst-case scenarios to test the integrity of the application in a faster and cost-effective way.

Maintenance: ChatGPT can significantly improve First Contact Resolution (FCR) by helping clients with basic queries. In the process, it ensures that issue resolution times are significantly reduced while also freeing up service personnel to focus their attention selectively on more complex cases.

For SDLC

Requirements gathering and analysis: Business requirements document writing, user story generation
Design: architecture UML, sequence/flow diagram, data model
Develop: code generation, code translation, detect bug/assist in debugging, explain, improve consistency
Testing: test cases, testing code generation
Deploy: On-Demand Code/Config Generation and Deployment, CI/CD pipeline generation
Maintenance: AIOps/monitoring/Automatic Failure Detection, With Suggested Remedies, AI-assisted support, documentation generation

Stage 1: Requirement analysis and planning

Generative AI can be used to analyze large volumes of user feedback, customer reviews, and other sources of data to identify patterns in user needs and preferences. It can help write specification/features requirements and assist in user epics/stories/tasks generation.

Stage 2: Design

Generative AI can be used to generate high-level architecture diagrams based on a set of inputs or specifications, recommends the appropriate technologies to use in a software system based on a set of requirements or constraints, e.g. performance, scalability, security, best practices, trade-off analysis. Generative AI can be used to automate the data modeling process by generating entity-relationship diagrams or other types of data models and assist in UI design process by generating wireframes or high-fidelity mockups.

user story, data model in markdown table format, data model in mermaid format, sql, sequence diagram, class design adhering to solid principle

Generate Mermaid.js diagram

Generate C4 diagrams using mermaid.js

Generate UX/wireframe with HTML/CSS

Stage 3: Developing

Usually most time is spent in this phase, where you need to implement software product. We are aiming for improved Code Quality and increased Productivity

Github Copilot (can write comment and let CoPilot suggestion solutions, type code and tab through suggestions), AI pair programmer (basic python, leetcode and test cases, call public API then Pandas dataframe, tetris game) is using Codex at backend and improves developer productivity.

GitHub Copilot Chat
Copilot for Pull Requests
GitHub Copilot for Docs

Hugging Face and ServiceNow announced StarCoder. Both StarCoder and StarCoderBase outperformed the largest models, such as PaLM, LaMDA, and LLaMA, despite their significantly smaller size. StarCoder is integrated into Hugging Face’s Transformer library.

Other related tools

The Tech Assistant Prompt is a tool optimized for assisting developers in programming related tasks. StarCoder Playground allow developers to generative code snippets from natural language inputs. There is a VSCode Extension that enables its integration into traditional development pipelines. The StarCoder Chat provides a conversational experience about programming related topics.

Codex is the model powering Github Copilot. The article has good points with any LLM

  1. Use prompt to guide. In coding, use comment (use the style of comments matching the programming language, e.g. ‘’’ ‘’’for Python, /**/ for C#, Java, JavaScript, Go)
  2. Be specific: e.g. programming language, data model, web page details, libraries to use
  3. Provide samples
  4. Guide with steps, which naturally turn into functions
  5. Use streaming to reduce latency

Blockstream’s public Bitcoin API. The data would be interesting to analyze.

Prompt to do data analysis

BI report generation/data analysis

In BI/data analysis world, people usually need to query data (small/large). Generative AI can generate commonly used query language (e.g. SQL/2/3, Kusto/2, pandas, Spark/2/3/4, Cypher). However, for people without coding background, it would be good if analyst can use natural language to query the data or even generate report over data (democratization of BI/data analysis)

https://www.datanami.com/2023/05/09/tableau-jumps-into-generative-ai-with-tableau-gpt/

Stage 4: Testing

Improved Code Quality means we are using test-driven development to drive code quality and documentation. However, writing test is time-consuming, often ignored which causes bad software quality. Generative AI can help improve writing tests better, faster, detecting/fix bad code.

Stage 5: Deployment

Generative AI can be used to automate the deployment of software systems, e.g. generate Infrastructure-as-code definition, container build scripts, Continuous Integration/Continuous Deployment pipeline or GitOps pipeline.

IaC generation

Generate Dockerfile

Automation script

Generate Continuous Integration

Generate GitOps ArgoCD YAML, even use Github provider to generate Github repo.

Aims to automate code review using the ChatGPT language model. It integrates with Github Actions, and upon receiving a Pull Request, it automatically sends each code review to ChatGPT for an explanation.

Stage 6: Maintenance

Generative AI can be used to automate the process of identifying and fixing bugs or to optimize the performance of a software system, significantly improve First Contact Resolution (FCR) by helping clients with basic queries. In the process, it ensures that issue resolution times are significantly reduced while also freeing up service personnel to focus their attention selectively on more complex cases.

In ITSM, ChatGPT can be used for automating the resolution of common incidents

Appendix

Lack of critical thinking (think from goal perspective and even challenge requestor) and idea generation

  • ChatGPT struggles to generate long bodies of text coherently. That’s not surprising, given that it’s optimized for short, chat-style interactions. There is challenge for LLM to generate large, complex software automatically.
  • ChatGPT codes like an expert beginner. It can help you be productive, but it can’t be trusted.
  • The best use cases for ChatGPT-like models are refactoring, reformatting, and improving small code snippets or quickly prototype an idea.

Won’t replace developers yet, but AI-assisted developers may perform better than non-AI-assisted developers.

Copilot

Good for:

Create a list of all states in US

Repetitive task like insert all database fields (no need to type manually of everything)

Don’t let copilot generate function (no comment-driven development), but let copilot complete some part

New developers should learn basic concepts (e.g. with ChatGPT) before directly using Copilot

PlantUML vs Mermaid 1, 2, 3

Follows steps below

Overall Structure: high-level steps for EDA
Data Cleaning: missing data, data understanding like column data type, expected meaning
Basic Analysis: data distribution, min/max, quartile, most common values

Here is the reason why prompt engineering even for coding with AI at this stage:

  • Computers can only do what you tell them to do
  • You need to be very specific with your instructions
  • They’re better at taking orders one step at a time
  • Algorithms are just a series of instructions

BECOME a WRITER at MLearning.ai //FREE ML Tools// AI Film Critics

--

--

Xin Cheng

Multi/Hybrid-cloud, Kubernetes, cloud-native, big data, machine learning, IoT developer/architect, 3x Azure-certified, 3x AWS-certified, 2x GCP-certified