Hi,
I enjoy spending my time helping people with programming stuff, so I will do my best to help you with any frontend related question or problem.
The kind of questions I will be able to best help with:
- How to implement a certain feature
- Code structure / design
- JavaScript / Vue / CSS / HTML / WebGL related questions
What I will do my best with but can't make any promises on are questions related to configuration (webpack, modules, etc.) or problems with libraries I'm not familiar with.
A PM is also ok if you don't want to post a comment 👍.
Top comments (10)
Hi Andi!
I've rebuilt an application in Vue, Node and so on that had been written in PHP.
One part of the application uses Cytoscape, and so far I've not been able to replicate it in JavaScript — it appears to be the asynchronous-ness of JavaScript that's the problem, when compared to PHP.
I tried the official Vue component for Cytoscape, but that appears to be riddled with bugs, and while the plain JavaScript version works with basic JSON data, it won't work with anything that's derived from the API and a database (as explained).
Thoughts welcome!
Hmm,
I'm not familiar with Cytoscape, but what is preventing you exactly from receiving some json from an API request and then passing it on to the library?
I didn't want to go into too much detail in case you weren't interested.
First, I have to parse the data into edges and nodes. Then, I use a recursive function:
services.acyclicalBuildingOfGraph = (userID, noteID, visited = [], depth = 0, maxDepth = 5) => { ... }
... to cycle through each node, exploring each link in turn to
maxDepth
.In PHP, this is simple, but in JavaScript, it's proving to be a major problem.
I'm still not quite sure where the problem lies. Is it the recursivity? Maybe if you can share the exact piece of code where stuff strats to break down?
First,
assetGraph()
is called, via the API:I think stuff starts to break down because you return inside the Promise in services.acyclicalBuildingOfGraph. If you don't call resolve or reject in a Promise it will never actually finish.
The problems I see are mostly around the confusion with async code in javascript. I'm assuming you need to use async code because Notes.getLinksToAsset(params) or similar calls are fetching stuff?
Async/await syntax is just syntactical sugar over promises, meaning that when you create an async function, it actually creates a function that returns a promise "under the hood". And when you say return inside of an async function it's like calling the resolve function of the Promise. But it doesn't automatically resolve normal promises.
I'd say you should put empty resolve() statements right before your returns, so that the Promise will actually finish. You can also just do
resolve(graph)
instead of returnresolve(graph)
.And at least your code should execute. You can take it from there and see if it actually does what it's supposed to do.
I've narrowed it down to something in Vue rather than Node
Andi, thanks for the time, much appreciated.
Hey man, you are to kind. I’m 4-6 months into my front end dev learning journey and have just started learning Vue.
Obviously, small steps everyday as this is a long journey which I’m enjoying but what are your thoughts on starting with learning a framework early to accomplish a specific task?
I figured hey, I wanna build PWA type headless eCommerce sites using Vue.
I think some days I feel like I’m not ready to move on from Vanilla JS but I figured I can practice both everyday and learn how to implement JS into Vue.
I guess as a new dev having to know HTML, CSS, (insert CSS preprocesser, library, framework ), then know JavaScript fundamentals, then to learn ES6 and then Only realize you NEED to know a framework to then learn about API’s and databases and all that to then having to to learn when and how to use what.
Sorry long confusing comment now but trying to figure out the 3-4 things I should be really good at to start with.
I assume in the real world, UI/UX designers provide you with mockups, then can you build out the front end without any logic, then connect it to their store backend and then publish it.
Any tips would be appreciated thank you 😊
Personal website here: brendinventer.com
Hey,
I know it can be daunting, and what you're trying to do requires a lot of different types of knowledge that you usually pick up over time as a web dev.
I think programming is one of the things where it's helpful to have strong fundamentals, but where you only really understand what's happening when you actually roll up your sleeves and start doing stuff and getting "dirty". I think it's fine to start with a framework early on, because it'll force you to understand some things about JavaScript if you want to be able to do what you want to do.
For example, Vue and other "Reactive" frameworks will force you to understand the difference between things being passed by reference or by value in JS and how that can screw you over when your UI is not responding to some changes you're making.
You'd be surprised how stuff gets done in the "real world". Most companies don't have a full product fit yet and don't know exactly what they need to implement next. It's usually up to you to work together with a UX designer(or even alone) to figure out how a feature would look like since there's always a tradeoff between what's ideal and what's possible. So expect to always be doing this kind of problem solving, unless you land a gig at Google or Facebook, where things are probably more compartmentalized.
One concrete piece of advice that I can give is to focus on one "feature" at a time. If you're implementing something in Vue, focus on that and don't worry about architecture or other things. If you have a specific problem, don't get discouraged and think you need way more JavaScript experience and then start doing a 1 month course on JS fundamentals. Research that specific problem, and learn how JS works in that specific instance, then solve it and move on.
Anyway, if you need advice now or in the future, feel free to post more comments or PM me.
Hey Andi,
Really appreciate the long thoughtful reply and insight. What you said just clicked for me a lot with learning how the framework and JavaScript work together in different scenarios and you right.
Sometimes I did something in Vanilla JS to only then learn Vue handles it a different way for a reason I don’t yet understand which then allows me to research why the JS engine needs something done that way. Closures, classes and scope really clicked for me with Vue and JS together.
I appreciate the insight and love the problem solving aspect of the industry for sure.
I’m working towards and entry level junior position so thanks again for the support.
All the best,
B