How can I implement feature specific failures in clean architecture?

There is this article by Fernando Cejas that implements CLEAN Architecture for Android. In part, it talks about handling failures, I’m interested in feature-specific failures.

 /**  * Base Class for handling errors/failures/exceptions.  * Every feature specific failure should extend [FeatureFailure] class.  */ sealed class Failure {     object NetworkConnection : Failure()     object ServerError : Failure()      /** * Extend this class for feature specific failures.*/     abstract class FeatureFailure: Failure() } 

Any ideas on how I should go about extending this FeatureSpecific class?

This is the github repo for his example project.

stuck on /dev/sda5: clean, 326275/24…. files, 2219669/96.. blocks when I boot my laptop

My laptop got stuck while running some simulations for the first time, and I had to turn it off by pressing the off button. Since then I am trying to boot my laptop and it gets stuck at the displays shared with this question, keeping in mind that I have dual system Laptop, which includes Windows 10 and Ubuntu 16.04. However, there is no issue with booting windows 10. As you can see I can’t write any command nor using Alt+Ctrl+F1, F2 or F3 is changing anything. I would really appreciate it if you may advise me what to do and it is very important for me that I don’t lose the data I have there. (maximum time I waited is around 30 minutes)Display 1

Display 2 (cuurent one)

Clean architecture – how can a component become a micro service?

I’ve read and enjoyed the “Clean Architecture” book. So the first thing I tried to do is to implement my project with it.

Where I work we follow a design method called “IDesign” in which the architecture is broken into: 1. “clients” – encapsulate communication with consumers (e.g. UI) 2. “managers” – manages business flows (drives use cases) 3. “engines” – stateless computational components (not always needed) 4. “resource accesses” – encapsulates accesses to data sources

A component of each type is logically a service so I was trying to treat each one as a component in “clean architecture”

what I’m having a hard time with is this.

RA (Resource access) component is clearly low level so manager for instance should not depend on it.

We can have multiple managers and engines using the same RA so according to my favourite uncle each should define its own interface and the RA component should implement all of them.

What I cannot understand is, if I’ll want to make the RA component into a micro-service, how would its API look?

I’m trying to follow this approach in a NodeJS project which makes it even harder for me to grasp how to implement such a solution..

The best I could up with so far is to have a single API for the RA and on each engine/manager to have internal onion architecture approach in which a repository layer class is implementing a “use case” layer interface and calls the RA api (in memory at first stage, through network potentially in the future).

another thing I struggled with are the entity objects. should the RA service map to them when returning response? again it makes sense when this is the same process but between micro services I’m not so sure..

Any thoughts?

Windows Sandbox (clean slate desktop) alternative?

What I would want, is a way to somehow run a clean slate of Windows in a sort of a sandbox, so that I could install programs in it for demonstration/presentation purposes, but then when the sandbox is closed, all of the changes introduced by installing that software disappear from the host OS.

So, I don’t just want to run a program in a sandboxed software environment ( like presumably in ); I’d like to have a “clean slate desktop” on demand.

I have just learned that there is Windows 10’s New Sandbox Feature … which looks like exactly what I need:

enter image description here

… but unfortunately, this is only for Windows 10 Pro, Windows 10 Home cannot use it.

Plus, I could imagine having to borrow a laptop for a demo/presentation, which might be Windows 7 or 8, so I’d like to have a possibility to basically install an application, that allows me to have a “clean slate” desktop on demand.

Now, the only other option I can think of, is installing some virtual machine (VirtualBox or VMWare), installing another instance of Windows in it, setting up a snapshot after installation completes, and then restoring to snapshot each time an installation is complete.

This I don’t quite like, because I basically have to use up disk space for two operating systems, just to do a “clean slate” demo. Plus, I’m not even sure it’s legal to set up a virtual machine of the same legal Windows install you have on the same machine.

Of course, I could also set up a separate user account on Windows, but then all programs I install will end up having bits and pieces in the host OS, even if I uninstall later (and I’d rather not uninstall even, I’d just like to close the virtual session and have all those changes gone).

So I was wondering:

  • Is it possible to set up a virtual machine on Windows, such that it refers to the host physical \media, and it reads the main OS files from there – but then, it accepts a hard disk image as the destination for the rest (user profile data, newly installed programs, etc)?
  • Else, is there some application, that does the same as Windows 10 Pro Sandbox, but can be installed on most other version of Windows (say, down to Windows 7)?
  • Else, what other options would I have, to achieve a clean slate desktop, which allows installation of programs in a sandboxed environment, such that when I close the sandbox, all of the changes due to the installation of programs in the sandbox are gone?

How do you justify more code being written by following clean code practices?

I’ve been following some of the practices recommended in Robert Martin’s “Clean Code” book, especially the ones that apply to the type of software I work with and the ones that make sense to me (I don’t follow it as dogma).

One side effect I’ve noticed, however, is that the “clean” code I write, is more code than if I didn’t follow some practices. The specific practices that lead to this are:

  • Encapsulating conditionals

So instead of

if( != null && contact.emails.contains('@')

I could write a small method like this

private Boolean isEmailValid(String email){...} 
  • Replacing an inline comment with another private method, so that the method name describes itself rather than having an inline comment on top of it
  • A class should only have one reason to change

And a few others. The point being, that what could be a method of 30 lines, ends up being a class, because of the tiny methods that replace comments and encapsulate conditionals, etc. When you realize you have so many methods, then it “makes sense” to put all the functionality into one class, when really it should’ve been a method.

I’m aware that any practice taken to the extreme can be harmful.

The concrete question I’m looking an answer for is:

Is this an acceptable byproduct of writing clean code? If so, what are some arguments I can use to justify the fact that more LOC have been written?

The organization is not concerned specifically about more LOC, but more LOC can result in very big classes (that again, could be replaced with a long method without a bunch of use-once helper functions for readability sake).

When you see a class that is big enough, it gives the impression that the class is busy enough, and that its responsibility has been concluded. You could, therefore, end up creating more classes to achieve other pieces of functionality. The result is then a lot of classes, all doing “one thing” with the aid of many small helper methods.

THIS is the specific concern…those classes could be a single class that still achieves “one thing”, without the aid of many small methods. It could be a single class with maybe 3 or 4 methods and some comments.

Find My Stolen Mini Mac After Installing New Clean Mac OS X Installation

My Mini Mac Stolen From My Office and I Think It’s Stolen By My Colleague. All Of Them Are Software Engineer and I Think The Thief Will Install The Fresh Version of Mac OS X On The Stolen Mini Mac.

My Question Is , Will I See My Mac’s Location Even The Thief Install Fresh Clean Mac OS X On My Stolen Mac ?

I Know Find My Mac Information Saved In NVRAM and The Thief Can Erase It Without Booting The Whole MAC OS X By Some Shortcut Keys !

Is The Serial Number Of Machine Pair With The Find My Mac Function on Apple ? If yes , I Can Find It Even Fresh Clean Mac OS X Installation ; No ?!

Thank You All.

How to clean my OpenSSL installation

I use Ubuntu 18.04. It was shipped with OpenSSL 1.1.0g . I tried to link manually compiled Python to a manually compiled OpenSSL1.1.1a but things does not seem to work well. When I now run Python it is automatically linked to OpenSSL1.1.1a. I want to revert this. I want to restore OpenSSL1.1.0g as the default library for my system and my system’s installed python. When I check my system’s OpenSSL version I get:

OpenSSL 1.1.0g  2 Nov 2017 (Library: OpenSSL 1.1.1a  20 Nov 2018) 

When I check:

whereis openssl 

I get:

openssl: /usr/bin/openssl /usr/include/openssl /usr/local/openssl /usr/local/openssl/bin/openssl /usr/share/man/man1/openssl.1ssl.gz 

How can I remove OpenSSL 1.1.1a and just leave the system’s OpenSSL 1.1.0g? How can I make Python linked to OpenSSL 1.1.0g? Any Python is linked to OpenSSL 1.1.1a now.