Pair Programming with Chat GPT (P-AI-R Programming, #2) by Michael D Callaghan

Pair Programming with Chat GPT (P-AI-R Programming, #2) by Michael D Callaghan

Author:Michael D Callaghan
Language: eng
Format: mobi, azw3, epub
Tags: Software Development, ChatGOT, AI, Machine Learning, Pair Programming, ChatGPT
Publisher: Michael Callaghan
Published: 2023-11-25T23:00:00+00:00


DATA GENERATION

Image by Thorsten Frenzel from Pixabay

Never Lack Sample Data for Your Apps

Generating sample data is a crucial aspect of application development, as it allows developers to test and refine their software in a controlled environment. In this chapter, we will explore the effectiveness of ChatGPT in generating sample data for applications. We will start with simple examples and gradually move towards more complex ideas, sharing both the successes and failures along the way. By the end of this chapter, you will have a better understanding of the capabilities and limitations of these tools and how they can be leveraged to improve your application development process.

As before I will show my simple comment, followed by what the AIs suggested, with commentary where appropriate.

Lorem Ipsum Text

I do a lot of UI development. Early in the app creation process, I like it when my pages appear to have content. I often turn to “lorem ipsum” text, which is nonsense text that has the same general “look and feel” of English when rendered on the page. There are dedicated websites that will generate it, but I thought it might be nice to have ChatGPT do it instead.

Generate a paragraph of lorem ipsum text

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum dignissim sagittis sapien, sed cursus erat condimentum nec. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ultrices augue ac metus fermentum, ac efficitur mauris pharetra. Vivamus egestas arcu lacus, in vulputate augue fringilla a. Donec rutrum, felis eu facilisis mollis, justo risus pulvinar mi, at aliquam ante sem in nunc. Integer ornare, est et lacinia tincidunt, arcu nulla ultrices ligula, in pharetra diam tellus et nisl.

It did exactly what I expected without any additional explanation. It just worked.

List of schools in the USA

For the next experiment, I wanted a list of schools that can be found in the United States. ChatGPT again came through.

Give me a list of schools in the USA as a JavaScript array

Sure, here's an example of how you might create a JavaScript array of schools in the USA. Please note that this is just a very small selection of schools for illustrative purposes:

var schoolsInUSA = [

{name: "Harvard University", city: "Cambridge", state: "Massachusetts"},

{name: "Stanford University", city: "Stanford", state: "California"},

{name: "Yale University", city: "New Haven", state: "Connecticut"},

{name: "Massachusetts Institute of Technology", city: "Cambridge", state: "Massachusetts"},

{name: "California Institute of Technology", city: "Pasadena", state: "California"},

{name: "University of Chicago", city: "Chicago", state: "Illinois"},

{name: "Princeton University", city: "Princeton", state: "New Jersey"},

{name: "Columbia University", city: "New York", state: "New York"},

{name: "University of Pennsylvania", city: "Philadelphia", state: "Pennsylvania"},

{name: "Duke University", city: "Durham", state: "North Carolina"}

];

This array contains objects, each representing a different school. Each object has `name`, `city`, and `state` properties. This is a common format for organizing data in JavaScript.

Fake Customers with Addresses

Next, could it generate some fake customers for me? Given what you’ve already seen, you probably have reasonable faith in ChatGPT getting this right.

Generate a list of random customer names and addresses

For the purpose of privacy and data protection, it's not appropriate to provide real customer names and addresses.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.