code-structure Questions

2

I have a local swift package Foo which provides two different libraries Foo and FooB. Now I would like to use them in another local package Bar. I am only able to get the whole package by path decl...
Chartography asked 14/12, 2022 at 13:25

3

Solved

I have a problem with using multiple annotations that all say more or less the same thing but to different frameworks and I would like to group them all into one custom annotation. Currently it loo...
Palila asked 28/4, 2017 at 11:53

4

Solved

Suppose I have a list/tuple of strings, COLOURS = [ "White", "Black", "Red" "Green", "Blue" ] for c in COLOURS: # rest of the code Sometime...
Airspace asked 1/9, 2022 at 16:49

16

Solved

Is there an official C# guideline for the order of items in terms of class structure? Does it go: Public Fields Private Fields Properties Constructors Methods ? I'm curious if there is a hard ...
Kauffmann asked 29/9, 2008 at 20:23

5

Solved

I am interested in delving into Erlang's C source code and try to understand what is going on under the hood. Where can I find info on the design and structure of the code?
Moskow asked 20/9, 2010 at 21:5

3

Solved

Is there a ready or idiomatic way of declaring an entry point in a Julia program (i.e. the equivalent of main in C or the if __name__ == "__main__" construct in Python)? This seems to be an import...
Mymya asked 24/7, 2014 at 1:30

4

Solved

I have just tried to lint some code with Pylint, and the last remaining error is R0902: too-many-instance-attributes (8/7) I understand the rationale behind limiting the number of instance attri...
Sarcophagus asked 26/6, 2014 at 15:27

2

Solved

The express-generator tool creates a file called bin/www and uses it as the application's main entry-point. I believe I've seen a couple of other modules do this as well, but the vast majority simp...
Lentissimo asked 1/4, 2019 at 8:47

3

Solved

Sometimes I like to use early return statements to prevent nesting if statement, which I find makes for less readable code. I am wondering if there is any objective or overwhelming general c...
Runthrough asked 13/10, 2016 at 1:56

2

These two PHP class methods violates Single Responsibility Principle (SRP) according to the phpmd rule booleanargumentflag. How should they be written to avoid this? If the solution is to remove ...
Pharos asked 16/9, 2015 at 8:9

4

Solved

In Kotlin, a function with at least one argument can be defined either as a regular non-member function or as an extension function with one argument being a receiver. As to the scoping, there see...
Haskel asked 10/2, 2016 at 14:31

2

Solved

I know the recommended way in Swift is to use: class Address { var firstLine : String? var secondLine : String? } but sometimes I see other developers write their code this way: class Address {...
Gush asked 31/5, 2017 at 15:12

2

Solved

I am writing my first app in react native and my js file is getting pretty big. What is the proper way to split the file up. If i have something like var MyClass = React.createClass({ ... }) ...
Gerfalcon asked 3/10, 2015 at 14:17

1

Solved

I'm trying to improve the documentation of my javascript code, and am following the JSDoc guidelines https://jsdoc.app/. I can't find how to document an intentional side-effect. For example the fo...
Troostite asked 14/8, 2014 at 18:20

4

Solved

I need to detect the direction in that a user scrolls - "up" or "down". Based on the code found in this answer: How can I determine the direction of a jQuery scroll event? I tried to wrap it in a ...
Phonsa asked 7/3, 2013 at 6:33

4

Solved

Context Single page / ajax web app Basic code structure LocationManager (responsible for updating the browser hash and switching the application location to a different tile) Page/Tile Flow Ba...
Gambit asked 21/8, 2015 at 13:26

10

Solved

I have an application written in Java. In is stored in several files. It uses different classes with different methods. The code is big and complicated. I think it would be easier to understa...
Byers asked 6/10, 2010 at 10:14

4

Solved

After reading the following, I think I understand the value of wrapping even the simplest of scripts in a main() function. Should I use a main() method in a simple Python script? Why use def main...
Ruano asked 31/7, 2014 at 21:37

2

I like properly documented code and it is no-brainer for me to have properly documented public methods describing the contract and same applies for private or package internal methods to expl...
Judgemade asked 17/4, 2014 at 23:35

2

Solved

I was wondering when you need to use module_load_include() or require_once to include files which are located within your module.
Assibilate asked 1/9, 2011 at 13:6

3

Solved

I have been given the below .NET question in an interview. I don’t know why I got low marks. Unfortunately I did not get a feedback. Question: The file hockey.csv contains the results from the Ho...
Checkerberry asked 22/6, 2012 at 3:12

9

Solved

Related Questions: Benefits of using short-circuit evaluation, Why would a language NOT use Short-circuit evaluation?, Can someone explain this line of code please? (Logic & Assignment operator...
Fribble asked 16/11, 2009 at 20:24

3

Solved

The project I'm working on is a business logic software wrapped up as a Python package. The idea is that various script or application will import it, initialize it, then use it. It currently has ...
Handle asked 15/4, 2011 at 10:56

2

Solved

Currently working on a 3D media engine using C# and I have come across a little conundrum. I have my rending loop figured out, I got a great plug-in architecture and content management system...
Creativity asked 3/2, 2010 at 3:30

3

It is good style to sort methods in header files in the same order as in the .cpp file, but often this order gets crude during development. How can I reorder the methods in the cpp file to the ord...
Magnetohydrodynamics asked 11/10, 2010 at 13:48

© 2022 - 2024 — McMap. All rights reserved.