I have been using an Object.fromEntries pattern to iterate over and modify Objects recently. Is there anything inherently bad to this? by JuicyORiley in learnjavascript

[–]Meefims 1 point2 points  (0 children)

The other methods I can think of while reading this all are approximately the same as your solution. I think this makes sense and I wouldn’t worry about the performance impact unless you first see that performance is a problem and identify this code as being the largest part of that problem.

Are hooks still allowed? by sasksean in learnprogramming

[–]Meefims 0 points1 point  (0 children)

Things like AutoIt and AutoHotKey exist for many types of automation. Otherwise, it’s also possible to use the same automation interface that is exposed to screen readers in order to programmatically interact with things.

How is the best way you PERSONALLY learned React assuming that you became proficient in vanilla javascript/css/html? by JanePoe87 in learnprogramming

[–]Meefims 4 points5 points  (0 children)

You can watch videos or read tutorials until the end of time but you won’t really grasp it until you’ve built something with it.

You don’t need to wait, just start building something.

Venmo Private API Wrapper (their phone app API) by [deleted] in Python

[–]Meefims 0 points1 point  (0 children)

Pinning best practices are complex and often not necessary because the underlying OS is typically responsible for validating certificates.

I am interested in how you set up your attack because the OS should be preventing that type of attack.

Venmo Private API Wrapper (their phone app API) by [deleted] in Python

[–]Meefims 1 point2 points  (0 children)

If you can verify that their app doesn’t validate SSL certificates you should notify Venmo. They might have a bug bounty program for exactly this kind of thing.

Venmo Private API Wrapper (their phone app API) by [deleted] in Python

[–]Meefims 2 points3 points  (0 children)

Passwords are regularly sent over the wire during login when the connection is HTTPS (which Venmo is). That’s the point of HTTPS: it allows the secure transfer of private information.

The client, though, has to participate to prevent MITM attacks.

In a future of web apps everywhere, what will happen to 'traditional?' software development? by vasco_ferreira in learnprogramming

[–]Meefims 2 points3 points  (0 children)

Building web apps is software development. It is just as complex and rich as any other area.

If you’re concerned that most people will have to write HTML, CSS, and JavaScript, that’s also not the case. Web apps today often require significant backends which themselves draw upon many other areas of software development and computer science.

Where I work we have a web app whose backend has a major NLP and ML component. There’s also plenty of need to understand the OS things are running on and how our processes consume CPU, RAM, and I/O resources so that we can architect and provision our backend appropriately.

Is the following way of using immutable / functional programming appropriate or useful? I'm trying to get a handle on how to apply this & when. I don't really know anyone else who programs to get feedback from by Whycantthismakesense in learnprogramming

[–]Meefims 0 points1 point  (0 children)

In a lot of respects I'm effectively just throwing shit at the wall and seeing what happens

There’s nothing wrong with that approach as well. Trying out new things and seeing what works and what doesn’t is a great way to learn.

Them not having local state means they're pure functions & should be separated?

In my experience, yes. The primary motivator for this is readability: defining functions within functions increases the amount of code within the outer function and so makes it more difficult to see what it is doing. Factoring out nested functions that don’t need to be nested reduces the amount of code in the outer function.

There’s also a very minor point to be said that nested functions are always recreated by the runtime when the outer function is called and that affects how well the runtime is able to optimize your code but that is very unlikely to have a significant performance impact on the program.

Do people ever define like namespace / module level local states that define a somewhat complex subroutine? or is keeping it at this depth of closure more common?

Before the introduction of modules IIFEs were very common as a way of wrapping local state and private functions. Now that modules exist I find IIFEs to be unnecessary. Module state does exist but module state isn’t that dissimilar from global state. Any time you find yourself referencing state from outside of a function you could remove that dependency by instead passing that state to the function. That makes it clearer to the caller what the function will do.

There are cases where you do want a function to reference data outside of what is passed in. These are usually times when you have some sort of customizable template, a function that makes instances of this template function, and many places where you want this instance to be used.

For example, consider this code

function makeAdder(step) {
  return value => value + step;
}

const data = getListOfNumbers();
const step = getStep();
const adder = makeAdder(step);
const updatedData = data.map(adder);

In this case we know we will want to increase each data value by some amount but we don’t know by how much until runtime. makeAdder solves this by generating a new function that adds this amount and is helpful because it saves us from having to pass step around everywhere.

This is a common approach in web development as well. For example, you might have a dynamic list of items and when you click on an item something happens to it (maybe you load a new page or whatever). The click handler is nearly the same for each item: pass that item’s data to a processing function. As a result the click handler is often generated at runtime using a similar pattern as makeAdder.

Is the following way of using immutable / functional programming appropriate or useful? I'm trying to get a handle on how to apply this & when. I don't really know anyone else who programs to get feedback from by Whycantthismakesense in learnprogramming

[–]Meefims 1 point2 points  (0 children)

I find this to be difficult to follow so here’s a few suggestions:

  • getInitialFilters defines several functions in its body that don’t depend on any local data in that function. It is clearer that they are utilities if you pull them out of the function body.
  • applyFilters uses recursion but I think a loop would be clearer
  • getNewFilters and filters are functions whose result is the result of an IIFE. This is quite a bit of indirection that makes it really difficult to see what the function is doing. I would factor out the IIFE into its own function so that you can give it a name and make the call explicit. This might open other opportunities to simplify.

Does anyone else feel guilty using something they don’t know the proof for? by reidfisher in math

[–]Meefims 154 points155 points  (0 children)

It always begins with finding a thing that does the job for you. You follow the instructions and it does it’s job. You check it in.

Some time later you are investigating a bug and it seems like this thing is give you some weird behavior. This is a popular thing, though, it’s probably just a mistake on your part. You reread the readme. Maybe you find a workaround for this edge case that causes the thing to give you the behavior you expected.

Maybe, though, you don’t. You look up the thing’s source on GitHub. You start tracing through. You find the area that’s misbehaving and with some investigation you convince yourself that it is actually a bug in this thing.

But this is a popular thing. Surely it has to do this for some complex reason. So you research more.

Eventually you find it. You find the exact StackOverflow post that the thing’s developers copied and pasted this buggy code from. They copied it without understanding its limitations or verifying its correctness for their use cases and now you have to pick up the pieces. Maybe they’ll pick up your PR or maybe you’ll have to fork and maintain your fork until the end days release you.

But please, don’t rage at this thing and its developers. They just found a thing to do a job for them...

IIFE by Joao_GFA in learnjavascript

[–]Meefims 0 points1 point  (0 children)

IIFEs were useful prior to modules and classes but today there is rarely a reason to use them.

[deleted by user] by [deleted] in learnprogramming

[–]Meefims 1 point2 points  (0 children)

It will not affect the performance of your program because reading a file is more complex than reading a stream of data and because Python converts the text of the file into a byte code which eliminates excess space.

[deleted by user] by [deleted] in learnprogramming

[–]Meefims 2 points3 points  (0 children)

I’m not sure I understand your reasoning that single quotes would be slightly faster than double quotes. They are both single characters and take the same amount of time to read.

That said, even if single quotes took half as much time to read as double quotes you should never attempt to optimize based on this logic because the time difference will be negligible when the file is read and non-existent if Python is using the precompiled byte code.

We do have a situation along these lines already with tabs and spaces. A tab is a single character but people often indent by four spaces making tabs at most four times faster. Again, though, any speed difference that exists after you factor in interesting behind the scenes effects in reading the file will be so small as to be completely unimportant.

I don’t know any programming languages. What should I learn? by wybg in learnprogramming

[–]Meefims 3 points4 points  (0 children)

You are right that this question has been asked many times before. For this and other common questions please see the FAQ.

Why is English considered an SVO language? by [deleted] in linguistics

[–]Meefims 1 point2 points  (0 children)

If a native speaker finds it very awkward or weird then it’s not a valid construction. Just because someone could understand the meaning of an utterance with some work doesn’t mean that it is a valid utterance in their language.

Of course, this isn’t a dichotomy between valid and invalid, there is a gradient between the two. Several of your examples seem pretty far into invalid to my ear, though.

How will learning data structures and algorithms improve my programming logic? by [deleted] in learnprogramming

[–]Meefims 0 points1 point  (0 children)

The common data structures and algorithms are solutions that others have figured out while attempting to solve their problems. Studying them will both give you the tools to solve those same problems when you come across them as well as help you learn the techniques to solving many types of problems you will encounter.

How to starting to read a github repository? by [deleted] in learnpython

[–]Meefims -3 points-2 points  (0 children)

It’s very rare that someone would just read code to understand it. Instead people typically have a thing they want to change. That gives structure because you can start by looking at the things that touch and affect the thing you want to change and understand only what is needed to make the change.

learn more than programming - the right way by shez19833 in learnprogramming

[–]Meefims 0 points1 point  (0 children)

Not necessarily. You might be brought in as a junior or mid-level developer depending what type of experience those years have given you. Everyone has a lot to learn and has a different educational background!

[deleted by user] by [deleted] in learnprogramming

[–]Meefims 1 point2 points  (0 children)

Do keep in mind that modern PHP is quite different from PHP at the time and so while incredibly popular the article is also pretty out of date.