#Refactoring tips maybe

1 messages Β· Page 1 of 1 (latest)

manic ore
#

Intial

#

In here

vale kiln
#

what would be best approach to share ?

#

paste bin?

manic ore
#

Whatever you like, if its a screen shot just make sure it includes line numbers

vale kiln
#

i will push it to gitlab

#

and share git

#

prob better

manic ore
#

as long as I dont have to do any work to see it fine with me

vale kiln
#

i will make the git public

#

you only got to click on hte link then

manic ore
#

Is it just a link to a git page?

#

ok cool

vale kiln
#

can you access it?

manic ore
#

yupp

vale kiln
#

assets => terminal

#

is the only relevant folder

#

the lib and "readonly" annotation is for the editor that i dont change it accidentaly

manic ore
#

So your making a sort of computer terminal the player can type in

vale kiln
#

yes

#

default commands is all commands in 1 class

#

which currently work

manic ore
#

Oh yea i actually watched that yesterday

vale kiln
#

i posted a new one πŸ˜„

manic ore
#

And what are you wanting to refactor?

#

And why?

vale kiln
#

default commands is a mess, i have to give it more love so that one not now XD

#

argumentparser => list interpolation and property searching

#

is a problem

#

the history class... if you see it you will cry πŸ˜„

#

its code from an asset that is 10 years old

manic ore
#

Thats ok. Old code isnt inherently bad because of age

vale kiln
#

the one who wrote it

#

has around 1000 lines of code

#

that was the only usable

manic ore
#

I dont really see any glaringly wrong with it

#

its small, clean, does what it does ant not much else

vale kiln
#

mkay

#

shell is rated from vs code analysis very bad

#

only 70% on code maintainability

#

my default commands has 50% but i know that XD

manic ore
#

Does VS Code give reasons, tips?

#

Because i would take VS Codes analysis with a grain of salt

vale kiln
#

it says remove cmd is trash

#

and all find and executes are trash

manic ore
#

Trash in what way

vale kiln
#

maintainability

#

thats the only value i get

#

in percentage

manic ore
#

Thats useless to me until I know what they mean by that

#

lol

vale kiln
#

luΓΆ

manic ore
#

Whatsd the metric

vale kiln
#

lul

#

idk cant see

manic ore
#

Theres needs to be a reason to refactor, not just because the Text editor says to

vale kiln
#

```Maintainability Index - Calculates an index value between 0 and 100 that represents the relative ease of maintaining the code. A high value means better maintainability. Color coded ratings can be used to quickly identify trouble spots in your code. A green rating is between 20 and 100 and indicates that the code has good maintainability. A yellow rating is between 10 and 19 and indicates that the code is moderately maintainable. A red rating is a rating between 0 and 9 and indicates low maintainability. For more information, see Maintainability index range and meaning.`````

#

i also want to use new stuff, which i dont know

#

as i work as java dev

#

linq and so forth are not common to me

manic ore
#

Are you a web dev?

vale kiln
#

no backend server

manic ore
#

mm

vale kiln
#

only UI i use is javafx and swing

#

everyhting else is just backend

#

but at home unity always πŸ˜„

manic ore
#

I gotcha

vale kiln
#

it could be also advises

manic ore
#

Im trying to learn enough to break into software development myself, no idea what path though

vale kiln
#

instead of refactoring

manic ore
#

That snippet you pasted is worthless lol

#

100 is a higher number and therefore better. 0 is lower and worse.

#

great......

vale kiln
#

tahts the official microsoft web page ..ofc its uselss πŸ˜„

manic ore
#

Well I honestly think you may be able to refactor, but it doesnt look that bad to me at all.

#

Classes are handling what they should, readability is fine

#

Maybe im still too new

vale kiln
#

its my own code

#

except history

manic ore
#

I assumed its always everyones own code honestly

#

Even if it isnt

vale kiln
#

i had the 10 years old asset

#

with the terrible code as example

#

and tried to make the same logic

#

in my one

#

so i didnt have to think about logic at all

crisp canyon
#

Periodically ask feedback on your code. Refactoring a codeblock requires readability by other developers. Does your code make sense for what it does? If I call your method, does it do exactly what the method describes to do?

Consider making your code easy to read and maintain is where you'd achieve the end of refactorization.

vale kiln
#

asset => terminal

crisp canyon
#

Sadly, I don't have time right now. I'm in between jobs and helping part time.

vale kiln
#

oww

#

you got time later?

#

to have a look?

#

im the next 24 hours awake

#

so i got tiem πŸ˜„

crisp canyon
#

Sadly nope I don't πŸ˜…

#

But I shouldn't be the only one to ask for review!

manic ore
vale kiln
#

ive put tho the new input system into my terminal

#

and works like a charm

manic ore
#

I love the new input system

vale kiln
#

as you said

vale kiln
#

if you have knowledge its easy

manic ore
#

Ah yea I waited till i was comfortable with the fundementals

vale kiln
#

that is the context extension

manic ore
#

I can see what you mean tho

vale kiln
#

i only needed the trigger

#

on button down

#

so i wrote context extension

#

to react on InputAction.Callbackreceiver

#

that it doesnt send each frame

#

only when pressed one single time

#

is that teh way to go?

#

it works

manic ore
#

Make sure it works in all cases you can think of, and if so, its a solution

#

See if it quits working on edge cases maybe

vale kiln
#

i tried it

#

couldnt find a leak yet

manic ore
#

Then there ya go

#

"Perfect is the enemy of finished"

vale kiln
#

how you mean?

manic ore
#

Theres a line you have to walk between gettings things done, and improving

#

If you are never satisfied with a solution or product you are making, youll never finish

#

If it functionally works, sometimes its best to move on and continue to finish whatever

vale kiln
#

prob should do that

manic ore
#

You can Always come back and refactor more

#

if you keep learning ya know

#

Sometimes we stay and try to make something the "best"

#

When its impossible

vale kiln
#

i can do lot of stupid stuffs with the terminal allready

#

but a terminal needs to allow stupid stuff πŸ˜„

manic ore
#

Can it make tea?

vale kiln
#

no 😦

manic ore
#

Needs more work then

vale kiln
#

gimme 1 min

manic ore
#

You need to hook that up to some robotics that deliver tea to your desk via a network command

vale kiln
#

im so happy that its very easy to add new commands

#

you wanted that tea command lul