Generic Coding Tips

Generic Coding Tips

>> Know the intent of your code. What is the purpose of your code? What should the inputs be? What should it output? It can be useful (especially for larger projects) to write out a flow chart that maps how information moves from task to task through the program.

>> Divide your code into sections that fulfill specific tasks, then chain them together. Sometimes it’s worth devoting a code section to its own file to be used by multiple programs rather than coding multiple instances of the same thing into each program. Consider what tasks might be useful for future programs.

>> Create a main project folder and don’t be afraid to use subfolders. Folder hierarchies are your friend when it comes to juggling multiple files in an easy-to-understand manner.

>> Consider having a “resources” subfolder, with pdfs, webpages, etc. of information relevant to your project. For example, I’m currently working on a program to calculate relic densities, so my project folder has a resource subfolder with research papers about relic densities. 

>> Comment your code! Seriously, future you will appreciate it. (I usually also keep a README.txt file in the same folder which describes how to implement the code.)  In the same vein, explicitly state any conventions you’re using and where you’re getting any data you import.

>> Test each section as you build it. Throw in sample values (preferably where you know what the output should be) periodically and make sure it’s doing what you want it to do!

>> SAVE WORKING VERSIONS OF YOUR CODE. Do you have a working build? Save it, then–before augmenting anything–create a new file and work on the next version of the code there. I do this usually via “save” and then “save as”.  Version control is to coding as save points are to video games.

>> Generating a lot of data? Consider saving a sample instance of that data in a subfolder. It can be a massive pain to troubleshoot portions of your program if you have to wait to generate hundreds of data points every time you run it. 

>> Getting an unknown error in a massive amount of code? Isolate the section of code containing the error(s), then create a minimal working example of the section, and keep adding to that example until you either figure out 1. why your original code failed, or 2. until you’ve constructed a new functioning code.

More Posts from Mariaagnesi-fangirl-blog and Others

Physics is an eternal chaos. You have to adapt to this condition and like it or you become mathematician.

Theoretical Physicist (via scienceprofessorquotes)

Reading the abstract of a scientific paper: ok I got this

Starts reading the introduction: ok I don't got this

Meet the patron of large families, Margaret of Scotland
In the year 1066, a displaced English princess named Margaret sought refuge in Scotland. Her father had been overthrown by the Danes and had gone into exile before she was born. While still very yo…
The Litany Of Saint Dymphna
The Litany Of Saint Dymphna
The Litany Of Saint Dymphna
The Litany Of Saint Dymphna

The Litany of Saint Dymphna

Leonid Meteors Tonight And Tomorrow Night
Leonid Meteors Tonight And Tomorrow Night

Leonid meteors tonight and tomorrow night


Tags

“The doctrine of the Incarnation therefore is of the greatest importance for Christian prayer. It is the basis both of Christian mysticism and Christian social action.”

— Kenneth Leech, True Prayer

A Processional Statue Of The Blessed Mother In The Sanctuary Of St. Stanislaus Kostka In Pulaski Park,

A processional statue of the Blessed Mother in the sanctuary of St. Stanislaus Kostka in Pulaski Park, Chicago.

Perfection is not only the reason behind the passion but your hard work matters a lot for your passion.

S.S.K (via creativespacetime)

  • tombombadilhateblog
    tombombadilhateblog liked this · 2 years ago
  • westfrosts
    westfrosts liked this · 4 years ago
  • mirastudiesphysics
    mirastudiesphysics reblogged this · 4 years ago
  • calmingclam
    calmingclam reblogged this · 5 years ago
  • calmingclam
    calmingclam liked this · 5 years ago
  • mariaagnesi-fangirl-blog
    mariaagnesi-fangirl-blog reblogged this · 5 years ago
  • mariaagnesi-fangirl-blog
    mariaagnesi-fangirl-blog liked this · 5 years ago
  • squidgirlautism
    squidgirlautism liked this · 5 years ago
  • freshoutoffucks4ever
    freshoutoffucks4ever liked this · 5 years ago
  • mbvsfo
    mbvsfo liked this · 5 years ago
  • bunnybooks
    bunnybooks reblogged this · 5 years ago
  • ultracasualdinosaurbouquet
    ultracasualdinosaurbouquet liked this · 5 years ago
  • studyblrenrose
    studyblrenrose liked this · 5 years ago
  • soqueentaco
    soqueentaco liked this · 5 years ago
  • celesolaris
    celesolaris liked this · 5 years ago
  • abscue
    abscue liked this · 5 years ago
  • dungeonsynths
    dungeonsynths liked this · 5 years ago
  • tips-tricks-planning-refrences
    tips-tricks-planning-refrences reblogged this · 5 years ago
  • realtaailleach-blog
    realtaailleach-blog liked this · 5 years ago
  • ccashmere
    ccashmere liked this · 5 years ago
  • kleoe
    kleoe liked this · 5 years ago
  • barcerona
    barcerona liked this · 5 years ago
  • studying-the-ineffable
    studying-the-ineffable liked this · 5 years ago
  • whotookmyjams
    whotookmyjams reblogged this · 5 years ago
  • whotookmyjams
    whotookmyjams liked this · 5 years ago
  • codingoverload
    codingoverload reblogged this · 5 years ago
  • codingoverload
    codingoverload liked this · 5 years ago
  • chickadeese
    chickadeese liked this · 5 years ago
  • fox-boots
    fox-boots reblogged this · 5 years ago
  • samtheslayer12345
    samtheslayer12345 liked this · 5 years ago
  • rad1calsch0lar
    rad1calsch0lar liked this · 5 years ago
  • samosachaatt
    samosachaatt reblogged this · 6 years ago
  • samosachaatt
    samosachaatt liked this · 6 years ago
  • whiskaye
    whiskaye reblogged this · 6 years ago
  • bigburgersupersonicjet
    bigburgersupersonicjet liked this · 6 years ago
mariaagnesi-fangirl-blog - The Farmer's Daughter
The Farmer's Daughter

"There is a pre-established harmony between thought and reality. Nature is the art of God." - Gottfried Willhelm Leibniz

164 posts

Explore Tumblr Blog
Search Through Tumblr Tags