(原理)[Prompting]Coding

工具 #

  • Copilot *** - 收费
  • AWS CodeWhispter
  • Cursor ***
  • tabnine 免费
  • Code Llama - 开源

代码相关-简单任务 [1] #

  • 注释
    你作为一名程序员,请解释一下下面这段代码

  • 防御性编程 请为这段代码增加防御性编程的功能

  • 写单元测试

  • 时间复杂度 time complexity 这段代码的时间复杂度是多少

  • 流程图 画出redis master和slave之间同步的流程图

  • Writing shell script

  • Writing git commands 一个分支中的代码合并到另一个分支中

  • Improve code

  How do i improve this code?
  fruits = ["apple", "banana", "cherry"]
  newlist = []

for x in fruits:
  if "a" in x:
    newlist.append(x)

print(newlist)
  • Translating Code 代码转换
    • Convert this Python code to Javascript
    • 请把下面这段python代码转换成Java代码

代码相关- 繁琐工作 [1] #

  • Building API

    • I need an API built with express.js to return the list of products. Each product should have attributes like ID, title, description, price and imageUrl
    • modify the code and retrieve the products from a MongoDB database
    • use TypeScript in this code
    • Generate this API using Python and FastAPI
  • Generating Dummy Data

    • Generate dummy data for a table called customers. Each customer should have an ID, first name, last name and city.
    • I don’t need a Javascript. Just give the data.
    • Create a Python class for storing these objects.
  • SQL

    • write a SQL query to generate a table called products with these columns: ID(int) title(string) category(int)
    • write a query to retrieve the top 5 customers in Shanghai
    • Revise this query and join the customers table with the orders table to find out how much each cumster has spent. Then pick the top 5 who have spent the most.
  • 正则 [2]

  • CronJob [2]

  • K8s

运维 Ops [4] #

编程语言 vs 自然语言 #

语言类型 执行原理
C++语言 C++语言 –> 编译器/链接器 –> 既定任务
Java语言 Java语言 –> 编译器/虚拟机 –> 既定任务
Python语言 Python语言 –> 解释器 –> 既定任务
人类自然语言 人类自然语言 –> LLMs –> 各种后端组件 –> 既定任务

参考 #

  1. 【ChatGPT】面向程序员的ChatGPT使用教程38种方式来提升生产力 V
  2. GitHub Copilot 实践课 03, 04, 06 AICoder git
  3. ChatGPT 帮我跑了一个完整的 DevOps 流水线,离了个大谱… Gin on K8s git
  4. PromptOps
  5. Top 20 ChatGPT Prompts For Software Developers