Tag Info

New answers tagged

0

It hugely depends on the type of system, but here are some things to consider. Hot patching allows your system to continue running while you deploy new features and upgrades. For this to work, you generally need to be working in a functional programming language, since such languages do not hold mutable state variables. Erlang is such a language; hot ...


0

You probably want more intermediate layers. One to lock or queue at a transactional level, so a device can be dedicated to one caller for multiple sequential requests and responses that must not be interrupted. And one for the device from an application level. For example, if you're talking to an LED matrix, this layer's API would be in terms of setting ...


0

There are essentially 3 basic aspects of the model: A List of users (identified and indexable using user-id) A Tree structure for the Categories and Subcategories The M x N relationship between users and categories/subcategories. Had there been a simpler structures of categories as linear list there would hardly be a question of how to do it. All ...


-2

Don't listen to your mentor too much. He/she too is groping around finding himself/herself. Do the best you can. Explain the best the way you understand it. Have friends. Learn from your colleagues. Treasure the technical expertise and experience of your colleagues. Explain to your friends what you do, and what the latest you are doing. You will find that ...


2

In most respects the std::unique_ptr was made to be drop in (but safer) replacement for std::auto_ptr, so there should be very few (if any) code changes required other than (as you ask) directing the code to use either unique_ptr or auto_ptr. There a few ways to do this (and each comes with its own list tradeoffs) below. Given the code sample provided, I ...


1

There are already so many answers, and I have to admit, great ones too. So it is hard to come up with something, which hasn't already been said. I am trying to do this in two parts: Part One - Analyzing, what is being said. Stop thinking/talking in terms of code. Think about abstraction and simplicity, talk as if you are explaining your design to ...


1

Get into the habit of using pictures. This could be UML diagrams, flow charts, state diagrame or whatever best fits the application. This gets you away from actual code into thinking about: What the code does. How the code is structured. These diagrams can then form part of the documentation for future maintainers, as well as for explaing to other ...


1

I will answer the title's question and then your specific question. The problem is that many programers are used to one way of thinking and that is making a big problem smaller to a degree they can tackle. Sometimes you need to think just the opposite. So ask yourself, "How can I stop thinking?" Meditation might help for that. It will make you a better ...


1

There are a bunch of things you can do to help yourself develop the habit of effective communication w.r.t. your code, your designs and what they all do. Take your time, it takes practice Listen to your peers; do they do it, how do they do it? Learn from those that you respect Learn and understand the core/classic patterns (aka GoF), understand these ...


4

Stop thinking/talking in terms of code. Think about abstraction and simplicity, talk as if you are explaining your design to some client or a developer who doesnt even understand what our code does. How do I foster this habit? I think something that hasn't been mentioned yet or focused on is the language you are speaking. While it sounds ...


21

In the simplest of terms, you're mentor is asking you to discuss the WHAT of a project, rather than the HOW. WHAT focuses not on the composition of the project, but rather what it allows a human to do (some call this an object's affordance). HOW is the underlying tools used to provide this ability. Here are a few examples. Google WHAT: A search engine that ...


0

Disclaimer: all I'll tell you come from my knowledge of "Domain Driven Design", which make things very clear. In Domain Driven Design, everything has a place. In the following diagram [*] : A --> B means A holds a reference to B. Interfaces Layer holds everything that interacts with other systems, such as web applications, RMI interfaces, web services, ...


12

I too had this problem. I realized that my brain would drift to implementation concerns whenever a discussion started. The problem with that is it limited my ability to be creative. Creativity requires that you consider ideas that may not work. Once you have an interesting / creative idea, you can then shift into a more critical "implementation" state of ...


4

Consider an analogy using the layered structure of programming: At the lowest layer is the machine code, binary command sequences for pushing bits to perform arithmetic, load and unload registers, communicate with hardware, etc. To make machine code friendlier to humans, we have assembly languages which ascribe recognizeable character sequences and ...


2

It basically boils down to manipulating a black box function. Learn what output he must give (to his boss, etc.) Decide what output you want from him to you. Factor other things affecting him. Modify the input you give him so you help him satisfy the goals he must meet while encouraging the proper return value to you. understand what he wants to get from ...


8

Your manager has his head in functional specifications and domain-specific terms, just as much as you have your head in code (where you think a few hours per day of "classes, function calls, variables, types, modules, threads and network connections", he thinks of "transactions", "customer-facing activity logs", "more responsive interface" and so on). ...


15

Learn more languages When you only know one language/paradigm (well), you only really have one language to describe what you want to be doing. That is only exacerbated by C++, which punishes you if you don't look after the minutiae of what is going on (memory management, undefined behavior, lack of tooling help when writing code). By learning different ...


85

Get to know your domain Every application is meant to solve a certain issue. This issue belongs to a domain, be it finance, transportation, human resources,... When your users talk about the application, they talk in terms of that domain. So when you think about your application, try to think in terms of that domain using the wording your users also use. ...


19

Very broad question, but my quick tips would be: Use a writing pad and a pen for designing your solution. Or a whiteboard. But not Notepad, the app. Seriously - just leave the keyboard. This by itself puts you into a different mindset already, and this different mindset is what you need. Our brains are wired to think in a certain way as long as our palms ...


0

I don't fully understand your requirements, but to me it seems you hit a point where C#'s type system is more going to get in the way than actually help you. I would simply drop the idea of using classes and inheritance and just create a generic key-value store where key it name or type of the propery and value is an object containing the value of the ...


1

Using strategy objects in the described way is a good start to simplify your PointBase class, I would not hesitate to introduce them even if they do not solve your problem with the BreakEven property. For allowing custom properties, you could provide some kind "extension mechanism" in your PointBase class (which I would rename to Point after the redesign). ...


2

I posted a question here that was brought about by the same problem: trying to both take advantage of the convenience of referring to objects by their base class, while at the same time using additional properties that their subclasses may contain. The solution that was most useful to me was to use the visitor pattern. In your Point base class, you define ...


0

I found some good help on this talk from Sandi Metz, one of my idols, Less the path to better design. At 16:05 the Stable Dependencies Principle comes up in the context I am interested in, class design. Her point is "you can't know", so embrace uncertainty. It's a great talk. So I went on and checked the churns of some of the apps I currently maintain ...


1

I'd implement a BanCommand class, which takes care of this. Domain models don't necessarily have to have state; sometimes they represent actions that take data and do something. That's pretty normal OO too; objects are behavior + state, but sometimes the objects don't really need any state to do something useful. That's why I always list behavior before ...


1

I would call one object's method from the other, to avoid code replication. I would find a way to do this like that : class BanService() { public function __construct(IUserRepo $userRepo) { $this->userRepo = $userRepo; } public function banUser($userId) { $this->userRepo->getUser($userId)->ban() } } or ...


0

The approach I've used a few times (I'm not sure if it's recommended or not) is as follows: Code business logic into dedicated business logic classes Have your entities use these business logic classes so that they aren't anemic Whether they're injected at construction, or simply directly instantiated is up to you. Any time I need a certain entity's ...


0

It sounds like both the API and the website share a common language (PHP). In such a scenario I often find that the functionality used by the API can often be abstracted out into a less API specific object that other solutions (like the website) can also utilize. This object would serve as a shared interface for the website and the API. Very little ...


3

That's exactly what interfaces are for. The programmer doesn't care what types of objects might be in the list, as long as they provide the method calls expected of any Observer. This way, your list can contain instances of MyTopicSubscriber, MyFileSystemChangeSubscriber, MyMailboxSubscriber, etc. (these are fictitious titles, of course). By using ...


0

For the moment, as 9000 said, I can't see any real reason to take another approach. However, if design is your main goal, perhaps you should separate your web app from your API server? That way both your web app and your mobile and native apps connect to a uniform REST implementation. Speed at that point is all on your API server, and REST pretty much ...


0

The concept of relational closure basically means that the result of any query is a relation which can be used in other queries as if it was a base table. This is an powerful concept because it makes queries composable. If SQL allowed you to write queries which output nested data structures, you would break this principle. A nested data structure is not a ...


2

I would suggest implementing command line parameters and command line help using argparse. The different functions could then be selected by command line options. If others without python installed need to use your program, then I would package it as an executable using pyinstaller. Pyinstaller can be used to build 3 possilbe executables: onefile, onedir ...


2

Have the 8 function calls wrapped in if __name__ == '__main__': Then you can call the script by running python NAME_OF_YOUR_SCRIPT.py If you need to pass any variables in when running it, use the argparse module


12

The key here is not just separation of concerns, but also the single responsibility principle. The two are basically different sides of the same coin: when I think SOC I think top-down (I have these concerns, how do I separate them?) while SRP is more bottom-up (I have this object, does it have a single concern? Should it be split? Are its concerns split too ...


2

IMHO, getting list of relevant classes is responsibility of a person. Getting list of people in the class is responsibility of a Class object, and definitely not either of the Controllers' one. Your Person class should have access to ClassService. Your class service should have access to PeopleService. Now, in your PersonController: return ...


1

If you're counting keystones saved, don't forget the possible shift; + and = are on the same key in many layouts.


1

There's no subtle technical reason for it. Using ++ is the more idiomatic form, probably because it saves one keystroke (or three if you put spaces around +=). The "evaluation part" will probably get optimized out in any langauge if it matters.


5

i++ means "fetch the value of i, then increment it, and return the value fetched". It can be used in expressions to both get a value and increase it in one go. It can also be used as a statement: i++; in which case the value returned is discarded. In that case it's equivalent to i += 1; When used in a loop, the same principle is being a applied: for ...


5

It's not about what is most likely to change, it's the difficulty of changing it. If you'd read your link, you'd see it says: "Stable" roughly means "hard to change", whereas "instable" means "easy to change". The concept can be better thought of as layers of software, it might be easy to change a UI, but much more difficult to change the API it ...


-1

MongoDB would allow you to create an index on Interests. When you create an index for a field which includes arrays, each array entry gets a separate index entry. So when your documents look like this: { _id:<<Objectid>> interests: [ "Programming", "Knitting", "Paragliding" ] } a query like ...


0

Here's what I would do: make no distinction between categories and subcategories. Each category would have parent category associated with it, which may be null (category and not subcategory). If I understand correctly, categories are not children of users, so if a user gets deleted, it won't delete its categories. In that case, you will need a child ...


3

To answer this, we should clarify the definition of static: Static methods are meant to be relevant to all the instances of a class rather than to any specific instance. They are similar to static variables in that sense. An example would be a static method to sum the values of all the variables of an instance for a class. For example, if there were a ...


4

The widespread antipathy towards static methods is largely due to fear that you won't be able to override a method easily for testing the class or mocking to test another class. With a private method this isn't a concern, so my opinion is: if it can be static, make it static - this acts as a useful bit of automatic documentation ("this method does not ...


1

How about option 3. Put the CVCalendarView on the VC's view, and a UITableView under the CVCalendarView. When the user taps a day, reload the table view with the new data. Since the calendar view is not in the table view, it will not need to be reloaded. When the user scrolls through the events of the day, the calendar will stay put. That's how I would do ...


0

So, first let's clearly re-state the problem in terms of its requirements: The system shall store a minimum of 4M records per day. The system shall provide a search interface to the user 2.1 The search capability shall return results in a maximum of 3s The system shall be capable of searching a minimum of 10.2 billion records The system shall use a ...


0

Thinking from the front end ... If you separate your lookup types in the UI, you might be able to have more reasonable constraints. It sounds like one lookup type is recent event-action data on an event, which allows you to isolate by time in your data search. This perhaps gives a much smaller set of data, with the likely expectation of a user that it be ...


0

I may be misunderstanding some details of your question, but I'll try anyway. This is how I would do it: I would structure App1, App2, etc... as Python packages, and would version these packages to map to App1_v1, App1_v2, App2_v1, etc... I would then create another package for site.com, and version it to map to site.com/2012, site.com/2013, etc... All of ...


0

Ignoring all the technical details this is an organizational/management problem and needs to be solved by the management of your organization. Your manager has to be willing to kick the problem upstairs and/or get his users to raise the problem at a high level. At your level put together or request an estimate for doing this with Oracle and Oracle ...


0

As Doc Brown says, joining properly indexed tables is efficient You make it easier on your application by defining appropriate views and dealing with the views rather than the underlying tables e.g. (Tested on SQL-SERVER, you didn't specify an RDBMS) See Fiddle CREATE VIEW URLsInPage AS SELECT Links.[Name], LinksInPage.[Page URL], ...


1

I would define "application core" as either code or library, that every other code or library depends on, and without it, it cannot function. It should contain only critically necessary features that your application needs to run. It shouldn't contain any domain logic nor models. In case of the article, it seems the "application core" is primarily managing ...


2

I would start by providing the right API to add columns to the table. If tableObject.addColumn (...) is appropriate then build that. You don't have to allow arbitrary column objects to be added to tables: you can control every aspect of the creation of an appropriate Column object via the Table addColumn instance method implementations. These methods can ...



Top 50 recent answers are included