The table of two values, Behaviour and Structure!
Is it more important for the software system to work or is it more important to be easy to change? If you ask the business managers they will say work is more important, some developers also go along with this attitude but that’s the wrong attitude.
Why the wrong attitude?
- If you give me a program that works perfectly but impossible to change, it means it won’t work when the requirements change.
- If you give me a program that does not work but easy to change, it means I can make the change to make it work.
If you’re a programmer with the attitude (1.) then one day your system will reach to the point where the change will be impractical (cost of change will be unaffordably high).
Eisenhower said, I have two kinds of problems, the urgent and the important, where the urgent are not important and the important is never urgent.
when it comes to software, The first value of software is behavior, is urgent but not always important. The second value is architecture, is important but never urgent. Of course, some things are not urgent and not important.
- Urgent and important
- Not urgent and important
- Urgent and not important
- Not urgent and not important.
Mistakes that business managers and developer make is to elevate items in position 3 to 1. It means they always fail to separate those features that are urgent but not important from those features that are really urgent and important and this failure leads to ignoring the important architecture of the system in favor of the unimportant features of the system.
So if you are a software developer, you are hired to maintain the quality and structure of the system and only you know the importance of the architecture.
Thanks for reading it, if you want to read in more detail, buy “Clean Architecture by Robert C. Martin”
Yes, correct you heard it right. It was the most awaited feature because nobody wants to spend a lot on Apple connectors, haha. But unfortunately, I don’t see people are utilizing this features. So here we go with one to kick start.
iOS device with later or
iOS 11 OS version.
- MacBook with
macOS 10.12.4 or later.
Xcode IDE with 9 or later
- Developer Macbook and
iOS device should be on same WiFi network.
I hope after reading prerequisites you are clear about what is gonna happen. Let’s move on further steps.
Step: 1 Here you need your connector cable for first and yes last time. Connect your iOS device and open Xcode.
Step 2: Switch to,
Devices and Simulators options, below is the screen for reference.
Step 3: Just enable the option
Connect via network.
Step 4: Sometimes it will ask you to provide your
iOS device IP to enter but in my case, it didn’t ask.
Thanks for reading!
Lots of developers consulted with me regarding on how to use storyboard with too many team members like when you have 20 developers on your team? So I have collected my thoughts on that today. I have used Storyboard as well as XIB so here are my thoughts on both.
- Storyboards are the really nice way to see complete application flow without running into Simulator, you can see the screen flow and the navigation between them, it’s one of key thing that makes your application architecture better.
- For a larger team of multiple developers it’s really difficult to use the same storyboard because at the end it’s XML file so really very hard to merge and you will end up with a lot of conflicts, So I have noted, a lot of developers suggest XIB here but I don’t see any reason why they choose XIB and I think the best idea is the divide the complete application in different storyboard according to their use-case, that is the first activity I always do, divide complete app into as much as possible storyboard you can (but it’s not like 1 storyboard for 1 ViewController) and use storyboard reference to connect them.
- I worked in rapid prototype development (deliver the complete application in 15-20 days, developed POC in 7 days) so the biggest benefit that I earned from storyboard is Mock-up, I can create complete app mock-up without writing a single line of code and really easy to manage the transition between views.
- Few issues that I feel with the storyboard is, it fails at runtime means if you made a mistake with segue name, the class doesn’t exist etc. Yes, it gives issue at compile as well only if you didn’t merge it properly (merge conflicts with XML tags).
- Using Storyboard, no need to run your app on the different simulator to verify the UI, it gives you fantastic feature called preview (Click on the Assistant editor, select your storyboard, choose automation to preview).
- Developers say it’s harder to reuse the code in storyboard but my opinion is, first think and implement, try to use mix approach with the storyboard, XIB (wherever requires use XIB to make it reusable on different storyboards).
- Yes, storyboard creates an issue when you create one in Xcode 8 and try to open it in Xcode 7 but lots of developers already raised this concern with Apple so hopefully, we will hear something from Apple soon.
Thank you for reading! Please do share your thoughts if any.
Why do we need to create frameworks? because it has three major purposes mentioned below and also you can share your code with your team, other developer or iOS community.
- Code encapsulation
- Code modularity
- Code reuse
Let’s create the iOS framework.
Now just give some meta-data about your framework like name, organization, identifier etc (I hope you’re already aware of it).
We’re good to go till now. Just add the files that you want to keep within your framework.
Build the framework project to make sure that you get build succeeded with no build warnings or errors.
Things that you need to take care.
- Make sure to check Copy items if needed, so that the files actually copy into the new project instead of just adding a reference. Frameworks need their own code, not references, to be independent.
- Double-check that each of the files has Target Membership in ThreeRingControl to make sure they appear in the final framework. You can see this in the File Inspector for each file.
- Double-check the access modifiers, while creating framework access modifiers plays very important roles.
- if you’re creating Swift framework make sure you’re extending classes from NSObject otherwise it won’t reflect once you will import the framework.
Thanks for reading.
Recent blog: SOLID vs STUPID
STUPID principles and yes this may hurt your feeling but yes if you are following this you are writing stupid code.
Well known design pattern, but mostly understood one as well. Like me, people are also fighting with Singleton syndrome. In that case, whenever we create a class we create it Singleton but why? That is definability not cool. Singleton also considered anti-patterns. We should think and avoid if possible because the program using Singleton are hard to test because of global state, with the global state they hide their dependencies.
Avoiding static things is important to avoid tight coupling. If it’s there then making a change in one module requires to changes another module too. Now it’s really difficult to reuse and difficult to test.
Testing is not hard, what you think? We don’t write test case may be because we don’t have the time or the code we are writing is bad because of tight coupling?
One of my favorite quote from Donald Knuth, premature is the root of all evil. There are only cost and no benefits. Actually optimised code is much complex as compared to just writing a loop.
That’s what I like most and I try to follow as much as possible. Name of your class, variables or methods should be clear because at the end of the day human is only going to read because programming languages are for human not for computers, computers can understand 0 or 1 very well.
That’s bad. Writing same code again and again so don’t repeat yourself, keep it simple and strong. Write Code only once.
Thank you for reading the quick introduction of STUPID principles, next will be SOLID principles.
SOLID principle is an acronym created by Robert C Martin also unknown as Uncle Bob. It represents five principles for OOPS.
Now the first thought that came to my mind is Why do we need this? Here is the answer, using these principles we can solve the problems of a bad architecture.
Fragility where A small change may break complete module it’s really very difficult to find this if you don’t have good test cases.
Immobility where A component is very hard to reuse in another project or we can say multiple places in the same project because of too many dependencies.
Rigidity where Single change requires lots of developer efforts because it affects several parts of the project.
Here I want to add principles will not turn a bad programmer into a good programmer you need a better judgment there. Principles have to apply with judgment and you must be smart enough to understand when to apply what.
I have also written one blog where they have mentioned one more acronym like SOLID and it’s STUPID. This may hurt your feeling but yes if you are following this you are writing stupid code.
Thank you for reading the quick introduction, In next blogs, I will try to define all principles with Swift Code.
Yesterday, I have posted about How to response Authentication Challange but thoughts came in mind that if you are going with the first options Provide authentication credentials is it really secure and safe? how is client sharing the credentials with the server?
After lots of Google, I have found, how’s NTLM works and it’s pretty interesting to see that client don’t share the password with the server. here are the steps as follow.
- The client makes the request to the server.
- The server needs to validate the user because there is no identity so server generates 16 bytes random number called as the challenge and sends it to the client.
- Client hash this challenge with the user’s password and return it back to the server that is called the response it also includes username as plain text and challenge sent to the client.
- The server sends everything to the domain controller and it uses the username to retrieve the hash of the user’s password from security account manager database and hash the challenge.
- Domain controller shares the response back to the server if they are identical then authentication is successful otherwise a failure.
So the interesting part is here that Network API doesn’t share the password with the server it means it very secure.
Thank you for reading.
Share your thoughts and feeback.