3 votes

Fortnightly Programming Q&A Thread

General Programming Q&A thread! Ask any questions about programming, answer the questions of other users, or post suggestions for future threads.

Don't forget to format your code using the triple backticks or tildes:

Here is my schema:

```sql
CREATE TABLE article_to_warehouse (
  article_id   INTEGER
, warehouse_id INTEGER
)
;
```

How do I add a `UNIQUE` constraint?

2 comments

  1. [2]
    gpl
    Link
    I have a general question for folks. When first using a new project written by someone else, say some github repo that is relevant to your work, how do you go about familiarizing yourself with the...

    I have a general question for folks. When first using a new project written by someone else, say some github repo that is relevant to your work, how do you go about familiarizing yourself with the code? Any tips? I always find this to be the slowest part of my workflow as I find it difficult to sit down and figure out how a code is structured, especially when documentation and comments might be lacking. This is in a academic context fwiw.

    3 votes
    1. Vapid
      Link Parent
      I rarely have to deep dive into code for repos that aren't relevant to my work or things I am working on. Recently I have been using React Aria and whenever I run into problems where I feel I need...

      I rarely have to deep dive into code for repos that aren't relevant to my work or things I am working on.

      Recently I have been using React Aria and whenever I run into problems where I feel I need a deeper understanding, I dive into its source code and investigate things that are relevant to the problem I am having. That way I slowly become familiar with the source code and every time I have to look at it, I have a "goal" that can be completed.

      When I started working on a legacy project with 10+ years of code, there wasn't much to learn by just jumping in and looking at the code. Sure, you learn some stuff that way, but you slowly hit mental overloads and stop learning. It started being easier when I got simple bug tickets to investigate where I had a "goal". "Okay so hmm this dialog isn't doing what it's supposed to - but where do I even start?" I didn't even know where the code was but I could just open the dialog, hit pause in my debugger, and it showed me the source file that contained the code for the dialog. Now I have a specific place to look, and a specific goal (fix the bug). Over 3+ years, I've started getting a pretty good understanding of how the application works and the structure of the code.

      Similarly, for open-source projects. It can be intimidating to start contributing or even knowing where to start. Some repos have a "good first issue" tag for problems that can be easy to fix for newbies to the codebase (here's an example from godot). Then you have a goal when looking at the code making it much easier to contextualize.

      TLDR: Reading to understand code without a goal is hard! Find something specific to work on and start exploring from there.

      3 votes