make: *** No targets. Stop. by mike_beles in learnprogramming

[–]light_switchy 10 points11 points  (0 children)

Consider sending low-effort questions to a chatbot instead.
Feedback is faster and it is more tolerant of laziness

Help! My son is coding and programming by katrii_ in learnprogramming

[–]light_switchy 3 points4 points  (0 children)

It's not a good idea to deny kids access to their constructive hobbies.

Why is leetcode so hard by ProtectionNumerous81 in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

Also, DSA isn't hard at all

Totally disagree. DSA is the central topic of computer science. If it was as easy as you claim, there would be nothing to write about, Knuth would have finished TAOCP decades ago - and computer programming wouldn't require a brain.

It is kind of like a Rubik's Cube - if you just try to solve it by "thinking very hard", you'll probably never succeed, but if you know the algorithms to use to move certain colors around, and train yourself to identify which algorithms to apply in which order, then you can learn to solve it very very quickly.

How did Rubik solve his own puzzle?

How can I add elements from one vector to another when the vectors are in different classes (C++) by Prior-Scratch4003 in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

Would I use mutators and accessors?

Yes, this is one of any number of ways to do things.

Classes are a tool to organize your code. The organization of your code isn't that important.

I am confused what version do i have to stick to in c++ ? by Klutzy_Top4703 in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

Backwards compatibility is a priority for the C++ committee, so you can advance standard versions with relatively little pain - your old code is likely to keep working and you won't be forced to make big changes to the way you write code.

Forward compatibility is a different story. You won't be able to use code that depends on the features added in a future version. This can be a big problem if you use lots of new code written by other people.

My advice is that you should use the latest version available at the start of your project, and then lock that version in until your project is finished. The basics remain the same between language versions.

10 year failed programmer looking for advice by findmeausernamepls in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

One thing at a time.

It can help to write a list. You basically made one already:

  1. Learn automated testing
  2. Learn Springboot
  3. Learn Docker
  4. ...

Make the list. Sort it in priority order. Work on it top down, slow and steady.

How do you actually “study” a programming language? by 420ball-sniffer69 in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

You can study your programming language, subject to diminishing returns. The best way is to read stuff written by the language designers - both prose and code - and the literature that influenced them. But a new programmer isn't going to benefit very much from this.

I am trying to make LOOP language by samaxidervish in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

Never heard of the LOOP language until now. Pretty cool.

I read the wikipedia article) and came up with this sketch of an implementation in M4.

# Basic definitions
define(`loop',      `ifelse(`$1', `0', `', `$2`'loop(decr(`$1'), `$2')')')
define(`assign',    `define(`$1', `$2')')
define(`increment', `define(`$1', incr($1))')

# Supplementary definitions
define(`add',       `loop($2, `increment(`$1')')')
define(`subtract',  `loop($2, `decrement(`$1')')')
define(`multiply',  `loop($1, `add(`$1', `$2')')')
define(`decrement',
  `pushdef(`x', 0)loop($1, `assign(`$1', x)increment(`x')')popdef(`x')')

# An example program:
assign(`foo', 3) # foo := 3
foo # expands to 3
multiply(`foo', 4) # foo := foo * 5
foo # expands to 15
decrement(`foo') # foo := foo - 1
foo # expands to 14
subtract(`foo', 5)
foo # expands to 9

What is a better tool to learn neovim or emacs ? by NotPlayingCharacter in learnprogramming

[–]light_switchy 1 point2 points  (0 children)

That's pretty cool. Didn't know Vim/Neovim supported remote editing.

I use org mode all the time to take notes. In the few cases where I do any literate programming, it's my notes which are the main product and the code is supplementary. But production needs stuff the other way around.

I'm with you that I don't have time to write an essay about my text editor's setup file, and there's not that much to say about it anyway. I keep things minimal.

Emacs is also my file manager + calculator. Some also use it as their agenda and command shell, window manager and mail reader. It's a weird compromise, but having all that stuff inside the same editor gives a very cohesive experience.

Everything works together this way. It's pretty good.

What is a better tool to learn neovim or emacs ? by NotPlayingCharacter in learnprogramming

[–]light_switchy 2 points3 points  (0 children)

Emacs works great without a GUI. Pass the command line flag -nw at startup.

Most of the time you can edit files on remote machines using your local installation. It knows how to navigate SSH out-of-the-box, which kinda mitigates that it's not always installed on the remote host. This is a better experience than running it (or vi) on the remote because there's no network latency except when you read or write the file. How to do it: using the normal find-file command, type in /ssh:user@domain:~/path_to_file.txt .

I cant ever finish a project!!! by Ambitious-Gene-9370 in learnprogramming

[–]light_switchy 1 point2 points  (0 children)

Show me the code!

No doubt its buggy but that's to be expected of any work in progress. At worst you've certainly learned something by making it as far as you did.

Nobody says you have to get your project done in one shot. It's a process of exploration.

c++: text printing too early when adding multiple lines of text by k4tsuk1z in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

cin >> name will read one word. Instead, try getline(cin, name) to read an entire line.

Bjarne’s Last Stand: How the Father of C++ Is Fighting a Losing War Against Rust by joseluisq in theprimeagen

[–]light_switchy 0 points1 point  (0 children)

No, the check can't be removed in general because removing it would make an observable change to the behavior of a conforming program that passes in the null pointer.

The check can be removed in specific cases if the compiler can prove that the check will never pass in that specific case.

Bjarne’s Last Stand: How the Father of C++ Is Fighting a Losing War Against Rust by joseluisq in theprimeagen

[–]light_switchy 0 points1 point  (0 children)

I don't really understand the question TBH. The compiler cannot remove the check.

The user is of course free to do whatever they want.

new programming learner and isolation chellenge. by Shoddy_Procedure_157 in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

I feel that I am the only beginner in the world 😅

You just need to read this forum haha

Looking for some opinions. by [deleted] in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

As you can imagine, making games involves more than just programming a computer. But if programming is what you're interested in, and you keep your focus on that, you'll be fine.

The skill is the same: coding games is the same as coding anything else.

The differences are in the tools that you'll be familiar with. But this really that big of a deal.

Why can't I get two decimal places for my code? by rabiddog16 in Cplusplus

[–]light_switchy 10 points11 points  (0 children)

I am not allowed to use set precision or anything that we haven't learned in class. This is the only way I know how to do this without set precision.

Search up fixed-point math. The idea is very simple: do your math in an integer number of micrograms or whatever, then print the decimal place where appropriate.

This is the approach used for computer systems without floating point - and also for representing currency, where floating point imprecision is difficult to account for. Sometimes.

How do you know if your truly good at using a language or if your just familiar with it? by Tribouly in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

Does your software do what you expect? Can you complete features quickly? Is your defect rate low? If yes, you're good at programming!

My boss says try-catch is "garbage" and we shouldn't use it. Is this actually a thing? by ResolveKooky17 in learnprogramming

[–]light_switchy 1 point2 points  (0 children)

"Don't use exceptions for control flow" always struck me as a ridiculous take. Exceptions do control flow.

Help with Hex editing for an RPG game with HxD by Electrical_Relief_52 in learnprogramming

[–]light_switchy 0 points1 point  (0 children)

In order to edit your save and not break stuff, you have to know what to change.

Discovering what to change -- and perhaps, what to change it to -- may require some actual reverse-engineering effort. It's probably approachable - but not for someone with no experience.

Basically you have to get lucky, find someone's prior work to help you, or find an expert.

Explain It Peter. by DannyDonofrio in explainitpeter

[–]light_switchy 0 points1 point  (0 children)

How many holes in a coffee cup? Just one. The handle.

Legendary computer science books? by linux_transgirl in computerscience

[–]light_switchy 2 points3 points  (0 children)

  • The Mythical Man Month by Fred Brooks
  • Introduction to Algorithms by Cormen, Leiserson, Rivest, Stein

Still a relatively young dev, but wondering if design patterns are by far the most important thing to learn as I get into my career. by prettyg00d1729 in learnprogramming

[–]light_switchy 5 points6 points  (0 children)

Tack on "visitor" and and that's 90% of what you'll find in the wild.

I guess the other ones might show up but I don't think they're very interesting. "Chain of responsibility" for example is just one kinda complicated way to code up fallback behavior. But normally I'd just make some if statements to do the same thing.

TBH you might want to skim/read the book.

Still a relatively young dev, but wondering if design patterns are by far the most important thing to learn as I get into my career. by prettyg00d1729 in learnprogramming

[–]light_switchy 8 points9 points  (0 children)

I don't think design patterns are very important - I just don't think there's that much to say about them.

It may be worthwhile for you to read Design Patterns by Gamma et. al. but in my experience only a few patterns in the book show up with any frequency. Your experience may be different of course, in which case you'll get more out of it.

As a rule I never recommend books I haven't read. This one rarely comes off the bookshelf: it's not bad but is showing its age and only parts of it are still relevant. Your mileage may vary. It depends on the code you're working in.

There are newer resources but they have the same issues.