By making four two block high walls around you you ensure that most mobs will not see you, the only exception being Spiders and Endermen that spawn or travel near your shelter. This problem can be avoided by making a roof with a one block hole.
This will allow light in so you can tell when day returns, but prevent any attacks. If it is an Enderman don't look at it, it will leave. If it's too late and you already have looked at it keep your crosshairs on it until you are ready for battle. It doesn't matter what substance you use to build your walls so long as they're two or more blocks high, which makes a snappy shelter.
Eight blocks is the minimum amount of blocks you need. If you don't have enough blocks to make your shelter then dig one block down, although you risk a Creeper falling in with you. This will, however, lower you enough where nothing can see you.
