Best practice for organizing DDL SQL files

I am developing a postgres database with the following approximate number of entities:

  • 60 tables spread across 7 schemas
  • 20 functions

What’s the best practice for organizing all the DDL SQL?

I currently have a single SQL for the table definitions, another for the views and yet another for the functions. But two of these files have grown to over 1,000 lines each and become unwieldy. That said, there are relationships between tables in different schemas and one file makes these easy to manage.

Would it be better to organize the DDL by schema? Or finer grain still, at the entity level?

I am using JetBrains DataGrip and would appreciate that the solution still enable Intellisense and error checking. The SQL is stored in git.

Organizing a “speedback” in a functional way

Speedback is the merging of speed-dating with feedback: a 2 min. 1-on-1 talk with all members of a group of people.

I’m in a team and I want to plan the ideal speedback setup. I want to group people in a way that maximizes the concurrency of simultaneous 1-on-1s so we reduce the total time of the sessions.

I found a library that gives me all combinations:

setOf("alexandre", "sergiu", "joana", "tiago", "susana", "david")     .combinations(2) 

This returns all pairs. Now the grouping. The first could be:

"alexandre" with "sergiu" "joana" with "tiago" "susana" with "david" 

then it gets harder..

Do you know which Kotlin functional method could help me (or can you hint about the solution)?

Organizing Github repository with multiple NPM packages

I have a JavaScript frontend plugin that is on Github. This plugin is also available on NPM. Now I’ve decided to adapt framework wrapper for popular frameworks such as React, Angular and Vue. These will also be available on NPM as separate packages with the corresponding framework suffix. So in the end the NPM packages will look like plugin, plugin-react, plugin-ngx, plugin-vue.

How to organize the GitHub side? There are a bunch of options which have pros and cons:

  • I could open a new repo for each package, so in the end I’ll have 4 repos for essentially one plugin
  • I could simply add new folders to the current repo and keep the framework wrappers there. But if I do this and let’s say I’ve a bug in just the React wrapper, how do I manage the release? On NPM only the version of the React wrapper will increase, but on GitHub I’m forced to update the version of the whole repo and things will get messy (or is there another way I don’t know about?)
  • I could keep the current repo and organize it with different branches, so each branch would contain one wrapper. Here I could also do releases per branch, release versions/tags would match on GitHub and NPM.
  • A completely different possibility I don’t know about.

I have little experience with this kind of stuff and I hope someone has a good advice. Maybe there are even official guidelines for this things, but I couldn’t find any since I’ve struggled to formulate this problem in a Google search.

Organizing large amount of editable content on mobile

I am working on altering a mobile UI for a client who needs to be able to add and edit data very efficiently, so in my mind efficiency > design.

My re-design is a lot more efficient than the previous, but I am not happy with the design and am worried users could get lost when scrolling between items.

Each input below is touchable and opens a modal for a user to enter content.

Any ideas to improve design & have a more clear separation between items that have been added?


enter image description here

Managing and organizing the massively increased number of classes after switching to SOLID?

Over the last few years, we have been slowly making the switch over to progressively better written code, a few baby steps at a time. We are finally starting to make the switch over to something that at least resembles SOLID, but we’re not quite there yet. Since making the switch, one of the biggest complaints from developers is that they can’t stand peer reviewing and traversing dozens and dozens of files where previously every task only required the developer touching 5-10 files.

Prior to starting to make the switch, our architecture was organized pretty much like the following (granted, with one or two orders of magnitude more files):

Solution - Business -- AccountLogic -- DocumentLogic -- UsersLogic - Entities (Database entities) - Models (Domain Models) - Repositories -- AccountRepo -- DocumentRepo -- UserRepo - ViewModels -- AccountViewModel -- DocumentViewModel -- UserViewModel - UI 

File wise, everything was incredibly linear and compact. There was obviously a lot of code-duplication, tight-coupling, and headaches, however, everyone could traverse it and figure it out. Complete novices, people who had never so much as opened Visual Studio, could figure it out in just a few weeks. The lack of overall file complexity makes it relatively straightforward for novice developers and new hires to start contributing without too much ramp up time as well. But this is pretty much where any benefits of the code style go out the window.

I wholeheartedly endorse every attempt we make to better our codebase, but it is very common to get some push-back from the rest of the team on massive paradigm shifts like this. A couple of the biggest sticking points currently are:

  • Unit Tests
  • Class Count
  • Peer Review Complexity

Unit tests have been an incredibly hard sell to the team as they all believe they’re a waste of time and that they’re able to handle-test their code much quicker as a whole than each piece individually. Using unit tests as an endorsement for SOLID has mostly been futile and has mostly become a joke at this point.

Class count is probably the single biggest hurdle to overcome. Tasks that used to take 5-10 files can now take 70-100! While each of these files serve a distinct purpose, the sheer volume of files can be overwhelming. The response from the team has mostly been groans and head scratching. Previously a task may have required one or two repositories, a model or two, a logic layer, and a controller method.

Now, to build a simple file saving application you have a class to check if the file already exists, a class to write the metadata, a class to abstract away DateTime.Now so you can inject times for unit testing, interfaces for every file containing logic, files to contain unit tests for each class out there, and one or more files to add everything to your DI container.

For small to medium size applications, SOLID is a super easy sell. Everyone sees the benefit and ease of maintainability. However, they’re just not seeing a good value proposition for SOLID on very large scale applications. So I’m trying to find ways to improve organization and management to get us past the growing pains.

Organizing and Creating a Custom Qt Widget

I am looking to create a digital Rolodex to keep track of contacts in Qt 5.9 and am uncertain how to efficiently create custom widgets. Examples online like the classic clock example show to completely override paint, but I want only to create a widget in design that is a collection of labels and buttons to display a list of contacts, and a few buttons to edit, delete, and create contacts beside it. The element entire arrangement appear multiple times across different parts of the application and it should look exactly the same in each.

enter image description here

I will have to create many other widgets just like this, so I am hoping to be able to drag-and-drop elements in designer rather than programmatically set everything.

Since each contact has its own little panel and picture, each contact is arranged in a scrolling list, and buttons are placed beside, we have:

  1. Create a ContactLabel custom widget with the picture, name, and address labels arranged
  2. Create a ContactsWidget custom widget with a Widget Listview containing a series of ContactLabel widgets, and buttons on the right.
  3. Wherever needed, drop the `contacts widget into a form.

It appears that visual studio addons and Qt Creator only want to create forms (which you can easily drop ui elements onto) or custom widgets, which only create code and do not automatically link in a ui file.

Is this an appropriate way to approach this problem and is there an easy way to drop in custom arrangements of controls?

Help organizing one round trip one direct trip international flights sitting together

I plan on going to a travel agent if I can’t figure this out on my own as I would like to keep the flights on the cheaper side and have always booked flight on my own. But anyways, for context, my boyfriend and I are going From Brisbane Aus to Nebraska USA, he needs a round trip ticket and I need a one way, but want to sit together on the flights going to Nebraska. I have seen in another question that this would be easy peazey going straight to the airlines website and booking there but since this is an international flight with (with all the times I’ve flown large distances) other airlines mixed in, it isn’t as easy to organize these flights just threw one airline.

If anyone has any personal experience with using a travel agent to book flights (I’m mostly nervous they’ll go for more expensive options just to get more money) I would love to hear about it. Also if anyone’s knows what to do for this situation.

Thank you!

Pattern for Organizing Shared code/API for Multiple applications/services

I have a single web server running multiple web applications and websites. For simplicity we’ll just say I have App A,B,C and websites D and E. All use a shared database and some tables are used in more than one app/site.

I’m at a point where I’m looking at restructuring a lot of this code, but I’m trying to figure out a pattern that will allow me to keep as much code as possible in one spot and I’m looking for a pattern to do it.

Almost all of the apps are MVC (some legacy ones aren’t but regardless). Some App A and App B may have the same model (tied to the same table) but implemented differently with different methods and such.

I had the idea of simply building a common API that all apps/websites would use, so that the API could serve as my “model” of sorts and the apps/websites would run gets/sets through the API.

The downside I see doing that is I’d need security groups in my MVC app to control things there, AND security groups stuff in my API, which seem cumbersome. I’ve also thought about, using an API for the stuff, but in my MVC applications, making the models be abstractions of the components used for the API.

Right now I have similar functions/methods in different apps which is a headache of course, but I’m trying to make it better. Are there common models for when an app uses it’s own API and security is shared between the two?