software-design

How should I organize the backend and frontend of my code?

天涯浪子 提交于 2020-01-03 02:52:09
问题 I have a project and I've written a lot of code for the backend (Flask / Python) and a lot of code for the front end (Vue). Up until now they've been separate folders / Github repos. I was wondering what was typical for combining them together with respect to (1) Github repositories and (2) file structure. The front end depends on some functions in the backend, so they'd need to be linked in some way, but since there is so much code for both aspects of the project, I thought it might be

Balancing Design Principles: Unit Testing

只愿长相守 提交于 2020-01-02 10:25:12
问题 I am writing a simulation of Bananagrams. Currently, I have a GameMaster class that maintains the common collection of pieces. The deal(Player) method deals a certain number of pieces to that player. I want to write unit tests for this. However, at this point, I have no getters, and thus no way to check the status of the objects. Why not add getters? I don't want to add code to the public interface only for testing. Right now, there is no other reason to expose those functions. What am I

Should I throw on null parameters in private/internal methods?

女生的网名这么多〃 提交于 2019-12-31 19:54:01
问题 I'm writing a library that has several public classes and methods, as well as several private or internal classes and methods that the library itself uses. In the public methods I have a null check and a throw like this: public int DoSomething(int number) { if (number == null) { throw new ArgumentNullException(nameof(number)); } } But then this got me thinking, to what level should I be adding parameter null checks to methods? Do I also start adding them to private methods? Should I only do

Should I throw on null parameters in private/internal methods?

笑着哭i 提交于 2019-12-31 19:52:26
问题 I'm writing a library that has several public classes and methods, as well as several private or internal classes and methods that the library itself uses. In the public methods I have a null check and a throw like this: public int DoSomething(int number) { if (number == null) { throw new ArgumentNullException(nameof(number)); } } But then this got me thinking, to what level should I be adding parameter null checks to methods? Do I also start adding them to private methods? Should I only do

Should I throw on null parameters in private/internal methods?

我的梦境 提交于 2019-12-31 19:52:05
问题 I'm writing a library that has several public classes and methods, as well as several private or internal classes and methods that the library itself uses. In the public methods I have a null check and a throw like this: public int DoSomething(int number) { if (number == null) { throw new ArgumentNullException(nameof(number)); } } But then this got me thinking, to what level should I be adding parameter null checks to methods? Do I also start adding them to private methods? Should I only do

In MVC pattern, can the Model interact / modify the View?

元气小坏坏 提交于 2019-12-31 03:22:46
问题 The MVC pattern component interactions are described this way on Wikipedia: The model is responsible for managing the data of the application. It receives user input from the controller. The view means presentation of the model in a particular format. The controller responds to the user input and performs interactions on the data model objects. The controller receives the input, optionally validates it and then passes the input to the model. I understand that the View should not be able to

the significance of java RMI please? [closed]

不羁岁月 提交于 2019-12-29 05:46:49
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Why do people use RMI, or when should I use RMI? I read those tutorials about RMI on oracle's website.But it doesn't provides enough

Front-end and back-end terminology

ぐ巨炮叔叔 提交于 2019-12-25 05:04:18
问题 While designing a Web Application in ASP.Net, I usually split the project in 2 parts, the back-end (the admin part) and the front-end (the visitors/SEO part). Let's say that my visitors can login on the website and will do a lot of tasks, like fill profile, send messages, etc. That part (authenticated user) looks for me a differente "layer" between Front-end and Back-end, and is somewhat hard define if is front-end (why visitors/users will handle it, but no admins) or if it is back-end (why

Create a database table where entries can come from another table or entirely new input

给你一囗甜甜゛ 提交于 2019-12-25 02:18:40
问题 I have a table of customers, employees, and suppliers. Each of them has some common fields like name, address, contact_no, and email along with other fields. Now, I want a new table called investors. However, investors can be from employees, suppliers, customers, or entirely new people. Investors also have the aforementioned common fields as well as their own fields. How do I go about designing the table? 回答1: How about having a generic table people that would contain the common fields (name,

Communication between programs in .NET

不羁的心 提交于 2019-12-24 02:26:07
问题 I want to separate modules of my program to communicate with each other. They could be on the same computer, but possibly on different ones. I was considering 2 methods: create a class with all details. Send it of to the communication layer. This one serializes it, sends it, the other side deserializes it back to the class and than handles it further. Create a hashtable (key/value thing). Put all data in it. Send it of to the communicationlayer etc etc So it boils down to hashtable vs class.