Connecting Raspberry Pi to a desktop/laptop for programming purpose initially requires you to connect the Pi to a network and then a monitor to see the IP address assigned to your Pi. You can then connect to Pi easily by entering this IP adress, into Putty or a VNC viewer.
Wait. What if you don’t have a monitor and no access to a router?

All you, have is just the Pi, it’s power supply , a Laptop and an ethernet cable. (Or you can even use lap’s hotspot if you have it).
Install Apple’s Bonjour service from here:

https://support.apple.com/kb/DL999?locale=en_US

Raspberry Pi’s default identification name is “raspberrypi.local”. After installing the bonjour service, reboot the laptop and Enter the identification name I said without quotes in to search field in the putty or VNC viewer.

Voila! You can connect to the Pi without knowing it’s IP adress!
You may follow this guide for more information and reference:
https://www.howtogeek.com/167190/how-and-why-to-assign-the-.local-domain-to-your-raspberry-pi/
I used to get route to host not found error constantly while trying to connect to pi, but following this method helped me fix it.