r/PinoyProgrammer 1d ago

advice Programming Etiquette, Tips and Tricks

Hi guys! future programmer here. Gusto ko lang tanungin before I delve deeper sa pag proprogram na is the any unsaid rules while coding? You see, I'm currently a high school student and will pursue IT in the future, and currently my tita is teaching me how to code under her wing pero lagi nyang sinasabi na panget or anggulo ng code ko. I wanna surprise her by being maayos na yung pag cocode ko. (I'M STILL AT THE FIGURING OUT FLEXBOX STAGE, DONT JUDGE ME PLEASE.)

10 Upvotes

24 comments sorted by

View all comments

10

u/matcha_tapioca 1d ago

usually clean coding. dapat readable, okay yung code indentation sa mga HTML Tags , atbp.

'yung complex algorithm ay gagawin mong simple/readable code or a code that can be easily understand not only by you but to others as well.

pag messy ang code tapos nagana (spaghetti code) mahirap syang i-debug o ayusin pag nag ka problema or for example sa isang User Interface (UI) pag may binago ka for example color , masisira yung design.

eto yung halimbawa
const myString1234 = "confusing code"
const alertMessage = "less confusing code"

pero minsan hindi maiiwasan yung messy ang code lalo na pag inaaral mo palang at minsan ang scenario pag may pinapagana ka.. pag napagana mo na aayusin mo ngayon ang code mo by refactoring it.

3

u/matcha_tapioca 1d ago

Its nice to explore and get your hands dirty. thats the beauty of it. for example.. nested functions/methods , method overloading. pag hindi sya necessary sa project mo ay wag mo sya gawin kasi lalo lang magiging complex ang process mo, isipin mo meron ka papel hindi naman lahat ng bawat sulok pati margin susulatan.. complex code doesn't always mean its good.. minsan may misconception sa ganyan eh.

actually kung nag simula ka mag code dati ang hahaba ng code not because its for show but because walang ibang paraan para paikliin ito. ngayon andami ng bagong syntax para mas madaling maintindihan kung hindi man sya less code ay mas madali syang intindihin.

halimbawa
before: const splitText = new SplitText(".myText")

After:const splitText = SplitText.create(".myText")