So in a negative construction, うちに means "before". 前に is also used to mean "before", but in verb-dict. form of course. How are they different? Also, while we're on this topic, with positive verbs うちに means "while" or "during". How is this different from saying ながら or 間? Are all 3 interchangeable?
前に is the easiest and clearest way to say 'before'. It can be used with the constructions noun + の、and Vnon-past。
- Noun + の
旅行の前に風邪を引きました Before the trip I caught a cold
試験の前に映画を見に行った Before the exam I went to see a movie.
- Vnon-past （する）
(this means verb in non-past/dictionary/casual form, whatever you know it by)
日本へ行く前に日本語を勉強しました Before I went to Japan I studied Japanese.
日本人はご飯を食べる前に「いただきます」と言います。 Japanese people say "itadakimasu" before they eat
Note that it is always non-past form, even when the action took place in the past (first example). The tense of the final verb in the sentence reflects the temporality of the whole sequence.
うちに refers to completing an action while a given situation is still in effect. Often, the implication is that, once the situation has changed, completing the particular action will become more difficult, less pleasant, etc.
- Vnegative （しない）
Used with a negative verb, if can mean before something happens (before it's too late)
雨が降らないうちにテニスをしてきます I'm going to play tennis before it rains
忘れないうちに言っておきたいことがあります I have something to tell you before I forget.
- Vpresent-continuous （している）・Vpotential （できる）
With the ている or できる form, it means 'while' or 'during'.
考えているうちに分からなくなった While thinking about it, I got lost/confused
働けるうちに出来るだけ働きたい I want to work as much as possible while I (still) can work
- い and な adjectives
Used with adjectives it also means 'while'
温かいうちに飲んでください Please drink it while it's warm
With nouns, it predictably tends to mean 'during'.
休みのうちによく寝ておきます I'll sleep a lot during the holidays (while I have the chance)
ながら has a more restricted use. When nagara is used, the subject must be the same in both clauses (same person doing the actions), and can only be used with verbs, unlike うちに.
新聞を読みながら朝ごはんを食べます I read the newspaper while eating breakfast.
With nagara, the second action is the main action of the sentence.
ものを食べながら話してはいけません You shouldn't talk with your mouth full (while eating)
When the subjects of the two actions are different, you can use 間
間 expresses one of two things.
- Simultaneous actions of approximately the same duration
私がご飯を食べている間、父はテレビを見ていました While I was eating, dad was watching TV
(this cannot be expressed with nagara, as the subjects are different (me/dad))
- A second action falls within the time span of first action
私がご飯を食べている間に、電話が鳴りました While I was eating, the phone rang
You could translate うちに to "before", but more accurately it'd be closer to "while" or "during" as in "during a period when a certain situation remains in effect."
雨が降らないうちに帰りましょう。= While it is not raining, let's head home!
前に on the other hand has a clearer distinction of what happens before.
私は東京へ行く前に日本語を勉強しました。= Before I went to Tokyo, I studied Japanese.
The use of ながら expresses actions that happen simultaneously.
私は踊りながら音楽を聞きます。= Every time I listen to music, I dance.
Here with using ながら the later listed action (listening music) is the focus. When using あいだに, both actions are of equal importance.