Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I know in python it is good practice to have a models.py and put all of an application's model classes in there. Does the same apply to swift or is it better to have a separate file for each model class?
Thanks!
Apple recommends to have separate files for each model class however it's possible to use the "Python style"
Assuming that your project is average..I would put each of your models in a separate file. Sometimes you end up with some small files, but I would rather go through that then some massive file where I can't find anything.
There is no single correct answer to this question, but Swift's system of controlling access suggests that it is not the best practice.
Properties and methods marked private are only visible within the same source file. If you put all of your model classes into a single file, they will all have access to each others' private methods and properties, which defeats the whole purpose of marking something private.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
In general, do you feel that Combine has developed enough that it can replace Cocoa Bindings?
I want to create a data model that is totally based on Combine #Published properties and attach it to my view controller and view with Combine.
But before I spend all the effort, I wanted to get you all’s thoughts on potential pitfalls or considerations I should be taking into account. Should I just stick with tried and true Cocoa Bindings?
Thanks!
Cocoa Bindings are great but they only work on macOS. Apple has signaled in multiple ways that the future of their frameworks is cross-platform (SwiftUI, Combine, etc). Combine is going to enter its third year soon. I'd say it's still early, but not too early.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
The community reviewed whether to reopen this question 9 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I am writing some interfaces for my design in SystemVerilog, I have many of them. I was wondering if there are some specific guidelines regarding how to organize them.
right now I have all of my interfaces in one file. I was wondering if I should place each one of them in a separate file or all in one file. And if there are some specific guidelines on how to name the file(s).
Thanks.
Although the answer might seem opinionated, tools are designed with one file per design unit in mind, and the name of the file should match name of the unit. So if the name of the interfacer is foo, the name of the file should be foo.sv This way the tool can search a directory for files without having to specify them individually. The *.sv extension lets the tool know the file is writing in the SystemVerilog language.
Having one file per unit makes debugging easier and simplifies code coverage analysis. There might be other reasons with respect to project management for adhering to one file per unit, but those do get more opinionated.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
It seems modern Scala libraries have some general pattern for exposing type class instances, I'm wondering if there's any formal spec out there or if someone could detail out what the idea is. Ideally, instances should be optional and the user should be able to supply instances or bring them in with the minimal amount of orphan instance or import tax overhead.
if the library supports export-hook, that's an obviously good way to go about things.
Otherwise, I think you're stuck either creating a trait with orphaned typeclass instances you can mixin where you need them, or just stick them in an object to import at will.
I suppose it's probably possible to stick them in a package object and have them in scope of anything downstream, but I dislike package objects as a general rule due to their fickle nature.
So the short answer is: if the OG library doesn't support export-hook, you gotta pay the import tax in some form or another.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've seen plenty of posts on the pros and cons of the EF but finding quite hard to find anything on the relationship between EF and project management methodologies such as Waterfall SDLC and Agile?
Would anyone have any links or information on the above? Thanks.
Frameworks and methodologies are typically orthogonal.
The only (indirect) relationship is that Agile methods would have you build your application to be decoupled from the persistence mechanism altogether. In fact, you would delay even using a database until you have a user story that requires that you have one. This would force you to keep the two decoupled, leaving your options open.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Thanks a lot , I want to know the difference between 'Form Created automatically' and 'Existed Form'
in Delphi XE3. (Tools->Options->Forms)
An "auto-created" Form is created automatically for you at program startup. The IDE inserts a call to TApplication.CreateForm() into your project's main source file to accomplish that. The first auto-created Form becomes the TApplication.MainForm.
An "available" Form has to be created manually in your own code, which allows you to choose when/how it is created.
The biggest difference is the forms, all get created whether needed or not, and all stay in memory until the application is closed (or they are explicitly destroyed).
My delphi experience suggests that using auto create nearly always leads to poor lifetime management and encourages monolithic code, and in general should be avoided at all costs.