3
\$\begingroup\$

I've recently completed a (to a certain version, anyway) project in Python and am looking to get feedback on it.

Problem is that I want feedback on how the project and the different components are organised: the architecture and "structure," not a specific routine. For that to happen, my different files will likely need to be seen. This will amount to a rather large post. (I basically want to leave scope for this topic to be covered, which will not be possible of I post sections of the code; I do also want "normal" review feedback, where people review whatever they are comfortable reviewing).

I'll quote a Reddit post below, where I asked a similar question, so you can get a sense of how big (or how small, depending on your experience) my project is, and what sort of context I'll provide.

To be clear, when posting to not-meta-Code-Review-Stack-Exchange,

  • I'll include code directly (not link to GitHub or other website)
  • Take care of the character count, and split into two posts if needed
  • Follow all other rules.

Would such a post be acceptable? If not, what would you advise me? If I'm expecting too much, that's understandable but I'm unable to figure this out.


Reddit post

TL;DR The following link would take you to a specific commit in the GitHub repo for this project (I won't change this so that any discussion is consistent). Can you please help me review the code in this?

Link: https://github.com/eccentricOrange/npbc/tree/efd5f37b82a42437a9ed0d61d20a8455dce6f0e0

What is this?

This application helps you calculate monthly newspaper bills. The goal is to generate a message that I can paste into WhatsApp and send to my newspaper vendor. The end result here is a CLI tool that will be later used as a back-end to build GUIs (hence learn about: C#, HTML/CSS/JS, Flutter). In its current form, everything will be "compiled" by PyInstaller into one-file stand-alone executables for the end-user using GitHub Actions.

The other important goal was to be a testbed for learning a bunch of new tools: more Python libraries, SQL connectors, GitHub Actions (CI/CD, if I understand correctly), unit tests, CLI libraries, type-hinting, regex. I had earlier built this on a different platform, so I now have a solid idea of how this application is used.

What files exist?

(ignoring conventional ones like README and requirements.txt)

File Purpose/Description
npbc_core.py Provide the core functionality: the calculation, parsing and validation of user input, interaction with the DB etc. Later on, some functionality from this will be extracted to create server-side code that can service more users, but I have to learn a lot more before getting there.
npbc_cli.py Import functionality from npbc_core.py and wrap a CLI layer on it using argparse. Also provide some additional validation.
npbc_updater.py Provide a utility to update the application on the user's end.
test_core.py Test the functionality of the core file (pytest). This isn't as exhaustive as I'd like, but it did a good job of capturing many of my mistakes.
data/schema.sql Database schema. In my local environment, the data folder also has a test database file (but I don't want to upload this online).

Known problems

  • Tests are not exhaustive (please suggest anything you think of).
  • Tests are not well commented (working on this right now in a local branch).
  • SQL injection is possible in some cases by --key CLI parameters, if you can figure out a way to insert a semicolon in an integer. I will remove this in a future version, once I find a way to improve or remove the generate_sql_query() function.
  • A lot of documentation is tied up in the CLI UI and comments, and is not an explicit document.
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Usually we don't review architecture and focus on the code instead. Proper SQL questions must include a schema, but this is often forgotten. If you would be able to post all the code, what kind of feedback are you looking for? Would a 'normal' review still help you? It's up to the reviewer to decide which parts they'll pick up on anyway, so I'm trying to gauge whether a review would be useful for you or more suitable sites exist. \$\endgroup\$
    – Mast Mod
    Commented May 2, 2022 at 4:30
  • \$\begingroup\$ @Mast, thanks. Part of this is my fault for not stating that I do want a "normal" code review as well (but I've now edited the post to fix this), but want to leave the scope for discussion about structure and organisation. Yes, I'm aware that reviewers will usually decide what they want to review, hence I didn't specify anything in my original post. Having said so, I did state my requests on a different Reddit post earlier, in case you want to take a look. DB schema will be included. \$\endgroup\$ Commented May 2, 2022 at 7:47

1 Answer 1

2
\$\begingroup\$

In (now-deleted) comments, you confirmed that your entire code exceeds the post limit. In a smaller program, the way to leave open the possibility of feedback on the arrangement of the code (modules, file names, etc.) is to simply post all of the code. Since you can't, I think where you've landed is reasonable; basically:

  • Include cross-reference links to the other questions in the group
  • Include a directory listing
  • Group questions by their code's "function theme" a.k.a. responsibility

Meta-commentary: if you find it difficult to meaningfully separate the code into distinct themes for the purposes of review, it means that your modules may not have clearly defined responsibilities and could use refactoring before you even post.

\$\endgroup\$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .