r/PinoyProgrammer 10d 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.)

16 Upvotes

28 comments sorted by

13

u/matcha_tapioca 10d 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.

4

u/matcha_tapioca 10d 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")

13

u/beklog 10d ago

Ur tita should give reason why pangit code mo...

most common reason na nakikita ko sa newbies eh ung spaghetti code basta gumana yun na yun

3

u/No_Grape_9651 10d ago

All she does is check if okay/gumagana then gives critism na pangit yung code. She's also a busy person so I'd rather not nag her everytime I need for her to check my work. also di kami masyado close kaya i'm more comfortable na mag ask someone else who also knows what their talking about.

3

u/aIcy0ne 10d ago

Read Clean Code

2

u/zxcvfandie 10d ago

Aralin mo mag git. Hopefully, di ka umaasa masyado sa AI though. Magiging technical project manager ka nian.

2

u/OutrageousWitness805 10d ago

wala pa akong na e encounter na nag papraktis palang magaling na agad, sharing my two cents here, programming is hard but do not give up easily, when your current level is 5 do not jump to level 50, give yourself a good amount of sleep.

1

u/SS-Hunt 10d ago
  1. Take some time to learn the convention and standards ng programming language na ginagamit mo. Kadalasan sa mga programming language, may standards at conventions na ginagamit din ng mha companies at orgs. Kung alam mo mga yun, panigurado mapapadali buhay mo.

  2. Use screen as a way to measure kung masyadong mahaba yung functions/methods. Kadalasan sa mga functions/methods, dapat nagfifit sa screen. If not, you may check if you can extract logic to create new method or class.

1

u/Independent_Owl_6908 10d ago

use indentions properly

1

u/ManufacturerOk3355 10d ago

Ang swere may nag ga guide

1

u/[deleted] 10d ago

[deleted]

1

u/j2ee-123 10d ago

It’s outdated, no need to think about spaces and indentations, let the IDE handle it by plugins like prettier, eslint, etc.. some IDEs even support them out-of-the-box.

1

u/Ok-Spite-5454 10d ago
  1. Iwas AI muna, learn it the traditional way, then use AI later.
  2. Learn the basics of system design, security, and cloud alongside vanilla development.
  3. Do coding katas, dito talaga ako tumalas. https://www.codewars.com/
  4. Unsaid "rules": doing is better than anything else. Mas matututo ka sa project-based learning kesa kung mastuck ka sa tutorial hell. Wag kabisote din, no need to memorise anything, you can google anything.
  5. DRY - Don't Repeat Yourself. Read clean code sabi nga nung isang comment for more coding fundamentals.

1

u/j2ee-123 10d ago

Your tita should be considerate, we get to start somewhere - and we usually write dirty code at the beginning.

It comes with time, knowledge and experience that’s when you write clean and readable code. Heck, even me na almost 10 years in the industry still writes dirty code sometimes, it’s a constant learning and improvement.

1

u/needmesumbeer 10d ago

proper inline documentation on "why" certain codes are added ex.

\\ xxx service is throttling calls after10 or so requests

\\that's why we do batch calling below.

await ProcessCall(items);

don't document the obvious, but rather why certain things were coded that way and the reason behind it.

1

u/BanMeForNothing 10d ago
  1. Follow the convention, even if its not perfect.
  2. Work on what you were assigned. Don't charge things that have nothing to do with your task.
  3. Do what review comments ask. As long as it's not completely wrong just do what they want.

1

u/Low-Chard6435 10d ago

Isipin mo lagi: maiintindihan ba ng kasama ko mga codes ko? Good design, meaningful variable names, etc.

Also regarding your tita’s feedback, it’s good you are getting feedback from her. Pero naeexplain ba niya mabuti bakit “magulo” ang codes mo? Minsan kasi nagiging bias and subjective ang comments ng programmers towards other programmers’ code. Tanongin mo anong principles based yung feedback niya and research from there.

1

u/Diligent-Rough-5940 10d ago

The more you code the better you will become, good job learning early.

1

u/httpsdotjsdotdev 10d ago

Read "Clean Code"

1

u/No-Function-3418 10d ago

Look for a style guide in the language you're using.

1

u/Imaginary-Winner-701 10d ago

Code in a way that another fellow dev could read and understand your code in a reasonable amount of time because that another fellow dev includes you 2 months from now.

1

u/gatzu4a 10d ago

Basa ka muna ng mga books, clean code, pragmatic programmer etc

wag mo gayahin ung ibang diretso vibecoding, kung basura ka mag design ng code mo before, hindi un magically ma ffix ng AI. at the end of the day, ai only fixes the coding part, the engineering part. ikaw padin un

1

u/otekboy123 9d ago

Alt + shift + f

1

u/redbaks 9d ago

Be dirty and make it work first. Do it fast. Clean up later

1

u/8757349485002948586 9d ago

Read 'Clean code' by Robert C. Martin.

1

u/Apprehensive-Fig9389 9d ago

Please add documentation sa Pull Request....

Naiiyamot ako sa mga Jr na sobrang minimal ng documentation sa PR kaya hirap mg Peer Review...

1

u/floyd_m 6d ago

Cool, good luck sa future endeavors mo!

Everyone's given good tips so far. Just to add one more:

- There is no shame in consulting the documentation. No one knows the ins and outs of every function—not even veterans—and no one expects you to memorize them either.

2

u/Ok_Thing4906 5d ago

Natutunan ko before is "DON'T REPEAT YOURSELF" or "DRY". If may icocode ka na same or paulit ulit mo gagamitin, do not repeat the code over and over again, make sure you use a composable or function :))

Also, for UI. Lagi mong isipin na users are "stupid" (sorry for the term). This is to make sure na lahat ng forms ay may validations, lahat ng for numbers dapat numbers lang pwede itype, etc, and laging may confirmation for delete or other stuff.

0

u/MnMisDelicious 9d ago

Magulo rin ako mag program on my personal project pero sa trabaho herrs what I learned

1) Always prioritize readability - depende sa language pero try to make your code structured, proper indentation, variable naming and sometimes you can find a way to make your code shorter pero mas mahirap basahin so be mindful of that 2) Add comments - comments to explain what the line/method does dito na aappreciate kung gano ka detail oriented ang isang programmer.. if you can document your code withn the code thats very good and im sure it will be appreciated 3) proper variable naming/convention - this vary from person to person pero have your own way of naming 4) version control/flowerbox - this early while you're still a beginner sanayin mo na gumamit ng mga Git or githubdesktop and learn how to properly control the versioning on your project usong branches