These are my notes from implementing Movie Magic using Devin, an AI-powered development assistant.
Devin takes a very different approach to code generation, functioning more like an AI apprentice than an expert assistant. It has knowledge of several computer languages and technologies but doesn't claim expertise in all areas. Devin's interface is tuned to a learning mindset, allowing you to provide documents and references to expand its knowledge base. Once it has learned how a technology works, you can prompt it to use it in your tasks. Here's a brief excerpt from my interaction with Devin to give you an idea:
Me: "What web technologies are you trained on?"
Devin: "I'm trained on a wide range of web technologies that are commonly used in the industry. This includes front-end technologies like HTML, CSS, JavaScript, and frameworks such as React and Angular. On the back-end side, I work with Node.js, Python with frameworks like Django and Flask, and Ruby on Rails. For databases, I'm familiar with both SQL databases like PostgreSQL and MySQL, as well as NoSQL databases like MongoDB. I'm also experienced with DevOps tools like Docker, Kubernetes, and CI/CD pipelines, as well as cloud services like AWS, Azure, and Google Cloud Platform. If you have a specific stack or technology in mind for your project, I'd be happy to discuss how I can help with that."
Me: "Do you know Next.js, Tailwind CSS, and shadcn/ui?"
Devin: "Yes, I'm familiar with Next.js and Tailwind CSS, which are popular for building modern, responsive web applications. As for shadcn/ui, I'm not familiar with it. If you could provide more context or documentation on shadcn/ui, I'd be happy to learn more about it and see how I can assist you with these technologies."
This exchange illustrates how to interact with Devin effectively. Generally, I found that I had to give very detailed and explicit instructions to Devin; otherwise, it would easily go off course. In other words, you have to micromanage it.
You can view my full session with Devin here.
Another important differentiation is that Devin has a full-blown development environment that includes:
- Command Shell: For running commands like
npm install
andnpm run...
- Browser: For interacting with websites to read documentation and run the application
- Editor: For editing files
- Planner: For breaking down tasks and executing them in order
Additionally, Devin provides a full VS Code editor for manual code modifications.
Me: "Let's start by creating a new Next.js project by running the following command:"
npx create-next-app@latest movie-magic-devin --typescript --tailwind --eslint
Devin: "Got it, Naresh. I'll go ahead and create the new Next.js project with the specified configurations."
Me: "Okay, now run the following command in the project's root directory to set up shadcn/ui:"
npx shadcn-ui@latest init
Devin: "I'm on it, Naresh... The shadcn/ui setup has been completed."
Me: "Here's the wireframe for Movie Magic. How will you break it down into components?"
Devin: "Based on the wireframe analysis, here's a proposed breakdown into components:
- Header Component: ...
- FilterSort Component: ...
- MovieCount Component: ...
- MovieList Component:
- MovieListHeader Component: ...
- MovieListItem Component: ...
- MovieThumbnail Component: ...
- Rating Component: ..."
Me: "I want a little more hierarchy. Here's what I am thinking; let me know if you understand:
- Header: ...
- Toolbar: ...
- MovieList:
- MovieListHeader: ...
- MovieListItem: ..."
Once the high-level structure was solidified, I instructed Devin to start generating code. The entire session lasted 2-3 hours (not counting coffee breaks :smile:), giving feedback and guidance to Devin as needed. Once I felt that the code was reasonably good and putting in more time into coaching Devin would not dramatically improve the quality, I stopped and started moving the code to my repository.
I tried to get Devin to commit code to my GitHub repository, but that did not work. I tried Devin's integration with GitHub as well as providing it with my personal access token – both methods failed. So, I decided to copy the code manually. You can view the repository at this point here, and here's a snapshot of the running code:
Key observations:
- Devin did not use
/src
as the base directory as explicitly instructed. It created separate directories at the root level such as/app
and/components
. I moved all these folders manually under/src
. - Devin mixed up Pages Router and App Router. The
<Toolbar>
instance was added to the Pages Router in/pages/_app.tsx
, hence it was missing in the running app. - Devin did not use the movie data that I provided. Instead, it generated its
own fake data (see
/app/movies/page.tsx
). As a result, real movie data and images are missing from the screenshot. - Devin kept using function expressions for components instead of function
declarations, despite being told not to do so (See
MovieList
). - Devin continued using
React.FC
in function definitions despite being told not to do so (SeeMovieList
). MovieListItem
is not used anywhere. The same code is duplicated inMovieList
. It seems that Devin missed deletingMovieListItem
.MovieList
is responsive; it hides the specified columns at thesm
breakpoint; however, the column widths do not conform to the provided specifications.
I made several changes to improve the code structure and functionality. You can see the changes in this commit.
Key improvements:
- The toolbar is now visible because it has been moved into the
MoviesPage
. - The movie list is showing the real data, including images.
- The page is now showing in dark mode. This is highlighting a few other
issues. Devin does not fully understand how to implement dark mode using
Tailwind CSS and shadcn/ui. This is evident from the table header, whose
background is hard-coded to
bg-gray-100
. That's why it has not changed to a dark color in dark mode, and the contained text is invisible.
Issues remaining
- The styling of the Movie List is awful. It would have been somewhat reasonable if Devin had followed the provided column width specifications.
- Devin did not use the
Sheet
andBadge
components for the Toolbar as instructed. - The overall look & feel needs to be tightened up.
The final implementation involved significant UI cleanup to match my manual implementation exactly. You can view the changes in this commit.
While Devin is an incredible piece of technology, and I really respect the expertise of the developers who created it, Devin itself is not a software expert. As mentioned earlier, it is a software apprentice who you have to patiently teach how you want it to build an application. If you are not explicit enough, it will definitely take wrong turns, which you will have to ask it to fix. Also, it sometimes uses less-than-ideal coding patterns and leaves unused code around. If you really like squeaky-clean code, you will be bothered by what it produces.
- Unique approach as an AI apprentice: Devin serves more as an apprentice than an expert. This allows developers to mold it to their specific needs, especially when working with less common technologies.
- Well-integrated development environment: The development environment provides command execution, browser interaction, and a code editor all in one place, allowing you to iterate over the results.
- Requires significant micromanagement: Devin's tendency to stray off course when instructions are not crystal clear is a significant drawback. This constant need for explicit direction is not just a minor inconvenience but can be very frustrating, especially when trying to maintain a smooth workflow.
- Produces code that often needs cleanup: Devin tends to follow less-than-ideal coding patterns (e.g function expressions as components), and leaves behind unused code. These issues can be particularly annoying for those who prefer a clean, well-organized codebase.
- Mixes up technical details: For example, not knowing the difference between Next.js App Router vs. Page Router
Devin shows promise as an AI-assisted development tool, particularly in its ability to adapt to specific needs with guidance. However, its current limitations in maintaining focus and producing clean code mean that it's not yet ready for serious production work without significant oversight. Developers may find Devin more of a learning partner than a polished tool at this stage.