Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
All code has a place where execution starts. Start there and follow the code either by static analysis or debugging. This is where a good IDE will outperform a text editor.
-
Bubbles66125y@groxx thanks! I’m still trying to also find my own methods that help me more to work through some of these but it also comes with just practicing with open source projects I’m assuming. I don’t really know anything about tests so I can’t use those, but I also just mostly get intimidated by the size and layout of the project and I don’t know what each file is supposed to do and I know in some cases it’s self explanatory but i just need to get through the intimidation phase of everything
-
@Bubbles looking at https://en.m.wikipedia.org/wiki/... almost all languages have a well defined start. Just search the project/folders/repo for that character string in all files.
-
@bkwilliams there might be more than one of those :) and there might be none if it's a plugin's code, or an old-fashioned servlet
but yeah, op should be looking for entry points. The ones the app gets loaded with and the ones thebapp starts processing with. Knowledge of some frameworks would help greatly.
Take Spring apps for instance. The main class usually does nothing but mentioning a few annotations and starting up spring. That's all. If ypu are not familiar with how Spring works it's a dead-end. If you look at those annotations they will give you a hint which classes or packages are used for configuration. Good luck finding them in a large project without an ide! 😁 but finding configs is not all. Knowing which beans are secondary entry points is also important. For instance @Conttoller annotated classes are secondary entry points -- they accept http requests and pass them to internal flows. W/o knowing you should be looking for @controller you'd probably never find those flows...
My point is that if advanced frameworks are in use, you might hit deadends everywhere you go unless you know how the framework works. That's some challenge! -
Bubbles66125y@netikras some of my problems is not knowing some of the libs that are used. For example in python I see requests used a lot and I understand what requests is but idk how it works and how to use it (I was planning on learning it but I’ve been workin on some other projects) and since i don’t understand how requests works (or whatever lib is taking its place) I don’t really understand the rest of the file/project. Which is more on my lack of experience but idk how to handle those situations as well
-
@Bubbles I do hope you are using an ide, like pycharm or so? Because they usually have pretty good mappings for most popular libs. Like in Spring's example, in the main class you have that green bean icon which, when clicked on, lists all the relevant beans, redirects you to all the relevant files.
Or.. You know.. Docs and tutorials? :) -
The first thing i do is go through all of the files of the project, fix indentation, check spelling and fix simple bugs where they are highlighted by my IDE.
After that I add comments to functions and classes that dont have any, even if I dont know what they do right now. As i debug and step through the project I update the comments to explain what they do.
Once that is done I set a task for myself, and start working towards it working through the code line by line if I have to.
Everyone has their own debugging method, find one that works for you and go form there. -
vane110545yI start with typing google and looking for “getting started”.
With messy code I usually cut and observe what happened on debugger.
With tricky case I always go from the bottom to the top so ex. if it’s web app with backend and database I start debugging from code where backend communicate with database. For frontend where frontend communicates with backend.
Those communication places are easy to find in any IDE and any size of codebase and with debugger it’s easy to understand what author meant to do. -
irene33925yI develop comments and docs until I can comfortably contribute them. If the code has poor accessibility, then I add the accessibility while I orient myself the codebase. Starting at the program entry point and looking for globales and how the program manages state.
If my comments explaining “why” things happen are not accepted as a pull request i strongly rethink my involvement or use of the codebase. Some developers think that conventions replace comments which is completely false. The cleanest code can only describe “what it does” and omits “why we do it”. -
Bubbles66125y@netikras I’ve just been using VSCode I don’t have an IDE for each languages I use sadly
-
Bubbles66125y@irene so you give yourself a little time to get used to it and learn what is what before doing anything big or adding anything code wise
-
@Bubbles are you a student? Jetbrains gives a 1year ultimate licence of all their products to all the students. Every year. I'm not a fan of sticking to one vendor, but let me tell you - their products are a-fucking-mazing! Webstorm, pycharm, intelliJ, CLion,.. Fuck it, it's one of the first things I've purchased a paid licence for in my life! [the first one was Sygic navigation, jetbrains - a close second] Worth every penny!
Dealing with a language is relatively easy. Dealing with libs and frameworks - that's where it gets tricky! -
Bubbles66125y@netikras I’ll have to try them out, I’ve heard many good things. Are the community versions also good?
-
@Bubbles yepp, also good. But some plugins and integrations are likely to be disabled or severely limited.
Like it will show the class is a Spring bean but it won't redirect you to the configuration that loads it by clicking on the bean icon. Mapping with other files [.Properties, .Yaml, etc] could also be limited. You get the picture :) -
Bubbles66125y@netikras I’m fine with stuff like that, I personally rather use sumn with not as many features than a lot of features.
-
@Bubbles it's up to you :) ex-student licence owners get a 20%off a normal lic fee. Just so you know :)
well okay, try it first :) -
Bubbles66125y@netikras I might lol are there any other IDE’s for Python or C/C++ you’d recommend? (Or that anyone that reads this recommends)
-
irene33925y@Bubbles Not time. I develop documentation. If I can build accurate docs i can make a bunch of trial and error changes (to docs) and never break the build. Then when my docs are done I can read over them and make changes to actual code because I wrote the manual.
Often it is just a good way for me to examine the code and it helps everyone else that comes after me too. Even if it has inline documentation I can check it to be sure that it is accurate.
Related Rants
Alright so I’ve already made a few posts about this but this time I kinda just want a general discussion and these are some questions I have.
So when you look at a open source project or just any project that you haven’t messed with, how do you start,
How do you handle messy code,
How do you know how to navigate the project or get around the confusion on the layout of the file,
How do you make sense of how/why the project is organized the way it is,
There have been times where I’ve tried and used one of the projects but it doesn’t work when it is supposed to already be working how do you handle those moments when there’s no error messages,
and (if you’re me) how to build/run the project
These are some of the major problems I run into when I try to start and they intimidate me heavily when I start to try to contribute to a project. I know I can just adjust the documentation or spell check which I will, but I also want to fix some bugs or add sumn. But yeah these are just things that I have problems with because I’ve only really ever worked with my code and projects so this is all still new to me and I’d like to hear your thoughts
question
open source