UI code: Is it handling too much?

So in short I’m working on creating a very specific CATALOG API store system with 4 sets of filters
I want to keep it very organized and I plan to redo it as I believe my current version is a spaghetti code mess

  • The broad category filter, weather the item is an accessory, bundle, hair, etc
  • The sub category filter related to the respective category, the specific item, eg: Accessory → Face, Head, Shoulder, Waist

The next set of categories are only available if the main category type is clothing

  • The style, Any, Medieval, Post Apocalyptic,
  • The group, the specific group related to the style of clothing

The filters are also all generated from a table of categories and subcategories
These categories decide what the CatalogSearchParams will be for the search.

The Store UI also has

  • a search function to send CatalogSearchParams a keyword
  • A scrolling frame where all the items will be generated into from a template

I’m trying to figure out:

  • How many modules would you say it should be seperated into? or all as one?
  • The best way to structure the project, Ideal file structure? Oop? any suggestions work
  • The filter system, look closely in the video, how can I create that ideally? Although I did technically do it the code behind it was very “cheap”?

The video below shows my current system (without the grid item generation system thing as I thought there wasn’t enough separation and I wanted to restart)

Ignore the UI on the right of the video, specifically referring to only store related stuff

Honestly, I’d recommend organizing the file structure into easily navigable folders that can be sorted through by a modulescript. You said that you wanted to redo the entire system that previously ran on all localscripts, right?

No the entire thing was split into 3 modules but I felt as if the seperation was still lacking.. as I understand good practice for modules is to have that module be dedicated to one thing and not mix too much up

My StoreUI module script handled the creation of populating the dropdowns, adding button functionality etc,

But it also handled creating a filter system and such, im not sure if that was too much or if it should be been elsewhere in a new module, shouldnt a UI module simply create and setup the UI, not have logic behind it? I imagine it should click a button and then call to another module :getnewitems() or something?
Then either setfilter would RETURN the items for the store to populate or it would be a bindable event (yes? No? Maybe?)

To me it also started to feel a little spaghettified and perhaps violating the dry principle

Edit: bump

In that case, you can simplify the existing module scripts by having the ui commands run on local scripts. Also, what you said perfectly makes sense, and I’d recommend trying the call to a module, then returning the items back. Seems self-explanatory for you!

Your system can be separated into 4-5 modules.
A store UI for tweening and setting up UI.
A PrimaryCatalagFilter to handle BroadCategory and sub category searching.
A SecondaryCatalogFilter to handle style and group.
A StoreUIManager to manage flow of UI.

The best way to a structure a project depends on your what your making. It can take a few tries to think of a good structure that is clean and scalable.

StoreUI and StoreUIManager should be one module.

and stop seperating each thing, just cuz ur using ton of modules dont mean ur a pro.
seperate by logic, not with every 20 lines

PrimaryCatalogFilter and SecondaryCatalogFilter is also ONE, stop being foolish, category - Filter.
Then make it one module

StoreUI is for all the methods, tweens and state control whilst StoreUIManager is for calling those functions.

The 2 filter modules could be one but splitting it makes its more scalable and more maintainable.

thats the dumbest thing ever, ur writing a wrapper layer for your own module, that’s insane (stupid)

ah yes split filter logic into filter A and filter B :person_facepalming:

StoreUI is for all the methods, tweens and state control whilst StoreUIManager is for controlling the flow and events.

You could easily have deep nested if statements if you have one big filter module whilst splitting it helps prevent this.

If you still on this, I could help you!

Like, doing the scripts for this system

  • This one is an old post

Ive mostly done the catalog aspect part
The main part im stuck on is posted here

Couldn’t you get the asset with the .DescendantAdded()? So then you check if its an acessory, and then you have it