Created
April 7, 2021 03:47
-
-
Save alanwsmith/b0b5a2fd667ce36aa7b9cc412d1990db to your computer and use it in GitHub Desktop.
Playing around with alternative to Newspaper Code Structure (via: https://kentcdodds.com/blog/newspaper-code-structure)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////////////////////////////////////// | |
// This is changing the grouping and alphabetization of the initial // | |
// example to gauge readability. // | |
/////////////////////////////////////////////////////////////////////// | |
export const thereIsABetterWay = true | |
export const bar = { | |
dontForgetMe: '!!!!', | |
some: 'property', | |
someOtherProperty: true, | |
anotherFunction() { | |
// forgot about this one... | |
// why is it here, instead of at top? | |
// who knows... Doesn't affect functionality right? | |
// but it might impact readability... | |
// especially if it gets long and stuff | |
}, | |
ohWaitNeedThisToo() { | |
// yet another function | |
// man, I need a few of these don't I? | |
// what other functions does this "bar" thing have? | |
// does this file export anything else? I guess I'll have to search around and find out... | |
}, | |
someFunction() { | |
// with plenty of lines | |
// and more stuff | |
// because... reasons... | |
}, | |
someOtherFunction() { | |
// because we need it | |
// it's really important... | |
} | |
} | |
export function longFunction() { | |
// I could really use a doughnut right now... | |
// Sometimes functions need to do a lot of things | |
// You should keep these functions short | |
// Otherwise your code is hard for a reader to consume... | |
// and that makes me sad :-( | |
// and confused | |
} | |
export function meToo() { | |
// make sure you scroll around the file | |
// so you know EVERYTHING that this module exports | |
// Because with this method, discovering that is a little difficult. | |
// There's gotta be a better way! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment