How can I make JavaScript more enjoyable? What tooling do I need?

Post date: 2020-10-19 20:01:50
Views: 94
Who should I follow on GitHub that's producing some quality JavaScript applications? Doesn't really matter what they are doing, but the code that makes you wish that you wrote it. I think at one point, one of the founders of Optimizely was committing great code. I'm more partial to backend practices. Second, I'm having to architect or guide an application that will have developers of varying skillsets commit and it'll be in Javascript. What's some advice you have? Examples inside:

I'm going to ask this very broadly and I'm not attempting to over-architect this but my Javascript is rusty. Previous applications I've used for large scale architecture was a cpp/Java/Kafka one which was easy once you got through the hell of setting up a large distributed system, because you just consumed/produced messages. Another was a C# application where I had a compiled assembly and developers had access to that and an XML config file. If they wanted access to the say "BeforeRequestMade" function inside the application they'd go into the config, inside the config they'd find the BeforeHTTPRequestMade and then enter the details of their own assembly class name and method name they'd wanted called. This method signature had to match it so that when I started up the application I'd reflect on all the loaded assemblies, find it, then execute it in the write order.

Here's my somewhat contrived example:

CEO comes to me with a URL and wants me to extract words that start with "A" ... it doesn't really matter just assume there's some logic that needs to be implemented to extract the data. He hands me this:


+-------------------------------------------------+
| URLs |
+-------------------------------------------------+
| https://www.gutenberg.org/files/1342/1342-0.txt |
| https://www.gutenberg.org/files/11/11-0.txt |
+-------------------------------------------------+


I then write this:

import axios from 'axios';

class NameExtractor {
static getNamesAndStoreByUrl(url) {
axios.get(url).then(resp => this.StoreNames(this.extractLatestPostId(resp.data)));
};

static NamesFinder(response) {
// Name logic
return names
}

static StoreNames(names) {
// Database logic
}
}

export default NameExtractor;


And I can call it like NameExtractor.getNamesAndStoreByUrl('https://www.gutenberg.org/files/1342/1342-0.tx') which isn't great as I have to do that twice for each URL but pretty simple job. Plus encapsulating
this.StoreNames(this.extractLatestPostId(resp.data))
. I then get handed another list, and additional information that they want to match another subset of logic, say last names:


+-------------------------------------------------+
| URLs |
+-------------------------------------------------+
| https://www.gutenberg.org/files/Abby/sdssksksk.txt |
| https://www.gutenberg.org/files/Bobby/sdssksksk.txt |
+-------------------------------------------------+


Those URLs are different but appear to be have the names masked in there, as if the names from the first assignment were used to generate those. To be sure I'd probably want to give a report to the CEO with the URLs he gave me AND a report from the names in the database. So if the CEO gave me a list of URLs that didn't have "Charles" in any of them but that's in the database might as well hit the URLs with Charles, do the name extraction and give a report on that too. If the CEO missed it great, if he didn't no harm. He also wants last names too.

The point being I'm now relying on data previously entered to generate and enter the URLs. I have to extract first names from the URLs, and I also have to extract last names. I have two team members that are joining to help me so I can continue working on the first names method, another member who works on finding the last names, and another who works on generating URLs from the database. Maybe even all of us writing code for tracing, etc.

How would you break that up? The changing requirements is something that'll come up and I think the example is simple but complex enough to be real. I can assume I don't want to cram "find first name" and "find last name" into one method and that I'll need some sort of way to queue up a bunch of here's a page run filters. And also an orchestrator to run URLs, some sort of caching so I'm not hitting the live site 500,000 times, etc.

How would you break that out? Is that enough info? Maybe it is just to me that Javascript's strength is that it is so malleable and non-opinionated this can go in a lot of different directions. I'd like to break it up so that it is flexible but also so that no one has to think too hard if they need to do something on a new name being submitted they don't have to manipulate a monolithic code base, and just hook into an event that's like, "Before first name submitted" check the database, do the logic and be done.

Not to add more to this, but the C# example worked great in that I effectively had a distributed "Version 1" of the main application. A team completely separate could create their own code base, get it running against Version 1 to make sure it worked, not have to fork and add code to the main application or anyone else's, send out the module as a zip file and have someone drop the zip file in, add something to a config file and it was done. It kept a single architect from lording over the project, it allowed multiple teams from different companies with varying skillsets working on the same project to get things done. I'm pretty sure a similar thing is done with dropping JAR files into Idea's line of products. I guess my point is that while a jQuery plugin author will have no control over what the main project does, this is a private project so there can definitely be some uptake involved by the main project. It isn't a hard isolation like an open source project might experience. If that helps what others might have seen on projects that went well in the JS world.
Number of Comments
Please click Here to read the full story.
 
Other Top and Latest Questions:
Hazbin Hotel: Welcome to Heaven
Trying to recall British TV drama from 2000s about teen model
Graphic novels for 13 year old girl
Dimensions of the iGaging 6" Absolute Origin calipers?
Movie: Knox Goes Away
Additional fields for Answers?
Turn off notification for award?
How to change the duration of "hotness" section
Delicious in Dungeon: Stewed Cabbage/Orcs
Best place to stay between Tampa and Wilmington NC?