#New to coding as a whole: How do these snippets look?

65 messages · Page 1 of 1 (latest)

white idol
#

I recently joined a local "boot camp" that's teaching C#, and then JS, HTML, CSS. These snippets are "projects" from the boot camp, but I am doing a little extra homework to try to get better so it's beyond what I've learned from them so far. How does all of this look? And any help or guidance on how to improve and good at-this-level projects I can explore to deepen my understanding would be beautiful, thank you!

keen heart
#

That's some very colorful code

white idol
#

i might have let my ADHD get the best of me in the extensions

keen heart
#

Code looks alright, a couple of things regarding the first (left) screenshot:

  • I'd probably change the name on the KiloCon method to ConvertKilogramsToMiles
  • I'd probably use verbs on the methods (since they're actions), e.g. CalculateSalesTax instead of SalesTax, that makes it a bit easier to immediately see what a function does
  • Rename the parameter to SalesTax from tax to originalAmount or something, the double totalAmount = totalTax + tax; looks a bit weird to me

(- I'm not sure if returning an Array from SalesTax is the best way to do things because I as a user of the function would have to constantly check what order the values are returned in - it might be worth it to create a new class here (maybe something like InvoiceTaxInfo or whatever that holds the data)

#

Also you don't really need the valid variable in the Req class since you're not using it except for stopping the loop -> might as well use the break keyword here

#

And I'd probably throw the tax rates and kilometer-to-mile conversion rate in some constants with clear names - I just guessed it's miles to kilometers but the code doesn't actually tell me anywhere

white idol
#

ah, yeah, sorry about that, it's in the main, but i didn't include that to keep from having too many screenshots 😬 sorry

keen heart
#

No need to be sorry lol

#

What's in the main?

#

I'm being very picky on purpose because you probably weren't looking for "yeah looks good to me have fun" lmao

white idol
#

main looks like the third screenshot, calling each of the functions

#

it's supposed to be function practice (i really only start learning about a week or so ago, so still very early days of just getting the basics drilled in)

#

and it's ok! i want to learn (: thank you!

keen heart
#

As for the second screenshot:

  • You don't need to declare, assign and return variables in separate lines when you're immediately returning them (for example in the BMI function that I'd call computeBmi you could just return the calculation directly, same for the AutoCost function)
  • This one has a lot of magic numbers in it too
  • Not sure if passing all of the car variables into the function as arguments is the best option here, possibly a class holding that info (CarCostInfo?)

And for the last one:

  • Looks alright, variable names give me a headache though (AutoCost probably shouldn't even exist and I'd rename Req to something like GetInputDouble)
  • As for the Req I'd probably rename the argument to prompt or something similar since you're passing in something that gets displayed to the user, not a response
#

That's about everything I can complain about I guess

#

Looks very good for being this early in your career though

white idol
#

candycute thank you i'll try to figure out how to implement the things you told me vv helpful

#

and i am sorry my naming conventions are crap, i am lazy

#

naming all stray cats cat and kitty mentality

keen heart
#

Kek

#

I think we all use shitty names

#

Just trying to prepare you for your first PR at work because you'll probably get slaughtered (everyone has this experience)

white idol
#

nodcat i am ready for the suffering

#

it'll be a while from now, but i am ready

keen heart
#

Think it took me a week (after writing the code) to get my changes accepted at my first job haha

#

And it was like what 10 or 20 lines of code

white idol
#

only 10 or 20 is impressive, though

#

i think

#

i don't know what's impressive, honestly, because i barely understand any code i read as is

#

i am trying to slog through C# in a Nutshell to help understand what you told me

keen heart
white idol
#

i will thank you BunnyHeartHug

#

OH do you know of any other projects i can follow to help drill in all the stuff you said? right now i struggle to understand how to return to stuff, use break without it ending the program, and using loops effectively to maintain user-friendly flow

keen heart
#

break just hops out of the current loop

#

As for projects, we have a graphic that we stole from somewhere with a list of projects with varying difficulty

#

But in the end you have to work on something that motivates you

white idol
#

i might just suck then suspicious because last i tried it it ended the whole ass program

keen heart
keen heart
# keen heart

I'd suggest you only look at the green (easy) ones for now

white idol
#

maybe pepoThink i don't remember i just remember immediately removing it

fallen kraken
#

For projects there's also:

#

!project

cerulean obsidianBOT
keen heart
#

Then once you can comfortably solve most of the easy ones you can probably move on

white idol
#

oo more projects candycute thank you, too

#

will do so, thank you both!

fallen kraken
#

The graphic is ripped from 4chan, just FYI

white idol
#

ask 4chan for advice, got it prayge

keen heart
white idol
#

i am sure they will have the most balanced, healthy takes

fallen kraken
#

A lot of those "easy" projects are very involved and complex

keen heart
fallen kraken
#

Which is why it's not officially endorsed by this server

#

"Easy"

"Fizzbuzz (BONUS: In Assembly)"

#

"Design a Game Engine in Unity"

keen heart
#

tbf fizzbuzz is pretty easy

#

game engine in unity sounds like a 1 year problem

white idol
#

i sort of did fizzbuzz once in js, but barely and i had to search up a ton of stuff

#

i'd like another shot at it because i don't remember it at all

fallen kraken
#

Pst: #🏋coding-challenges

white idol
#

👀

keen heart
#

Lots of fun cödering challenges

fallen kraken
#

There's 800-something projects for you in there, heh