The kit lens that came with my canon is an 18-135mm lens, but I hardly ever use it because I prefer my prime lens (I know a lot more about prime lenses than zoom lenses). One of my friends has a 24-70mm f/2.8 Nikon lens and I found it odd that his zooms without changing the physical length of the lens, but mine does. In addition, the maximum aperture changes in my lens depending on how far it is zoomed in, which I assume is due to the fact that aperture has a direct relationship with focal length. My main question is, what is different about the two lenses that allows the 24-70mm to zoom in without changing aperture or physically extending the lens and why aren't all lenses made like that?
It all depends on the design of the lens and what is most important to the designers. Ease of use regarding size and weight? Low cost? Optical performance? Weather sealing and durability? Wider/constant maximum aperture? A wide range of focal lengths?
The reason not all lenses are designed with internal zoom, constant aperture, and internal focus is that different lenses are designed to do different specific tasks and to be produced at specific price points. In the case of your kit lens the consideration of keeping the cost lower and allowing for a wide range in focal lengths necessitate the use of an extending lens barrel.
Most internal zoom lenses have a smaller ratio between the widest and longest focal lengths they can do. Common lenses with internal zoom are 70-200mm in which the longest focal length is just under 3X the shortest focal length. There are very few lenses with internal zoom that exceed that 3X ratio. Lenses such as 24-105, 70-300, etc. almost always have a barrel that extends as one zooms, even the more expensive ones.
The same is generally true with constant aperture zoom lenses. Most constant aperture lenses also have a 3X or less ratio between the longest and widest focal lengths.
If one were to try to extend the designs of, say, a 70-200mm internal zoom/internal focusing lens to be a 70-300mm lens the internal zoom elements would bump into other elements of the lens before they could travel far enough to extend the focal length to 300mm without extending the length of the barrel.
The 24-70 is an expensive lens. When you start getting into more expensive lenses, the aperture may stay constant, the lens may not change length while zooming, the lens may not change length while focusing, etc. Kit lenses most likely will never have anything like this. If you were to go buy an expensive zoom lens, it's likely that the aperture will be constant no matter what focal length.
The focal length assigned to any lens is a measurement taken when the lens is imaging a far distance subject like a star or distant mountains. In other words the distance lens to focal plane is made when imaging objects at infinity (symbol ∞). When imaging objects closer than infinity, we must extend the lens further forward away from the focal plane. This now elongated distance is termed “back focus distance”.
Now the f-number are computed by dividing the working diameter of the aperture hole into the focal length. As an example, if a 50mm lens is mounted and its aperture diameter is 12.5mm then the lens is said to be functioning at f/4.
When we zoom in and out with our zoom lens, we are changing the focal length. If the aperture diameter is 12.5mm when zoomed to 50mm, then f/4 is realized. If we zoom to 100mm, to keep the same f/4 the aperture diameter must somehow be changed to 25mm. This would require a mechanical linkage that adjusts the working diameter of the aperture as you zoom. Such a mechanical linkage can be fabricated but this method proves too expensive thus lens makers use another approach.
The modern zoom is comprised of multiple lens elements, each with a different focal length. Some of these elements move as a group as you zoom, some move independently. The lens forward of the aperture functions like a magnifier that changes power as you zoom. The action causes to diameter of the aperture to perform as if it is bigger when zooming to a higher focal length. Conversely, as you zoom and reduce the focal length, the appearance of the diameter of the aperture shrinks. This clever design works and the f-number can be maintained throughout the zoom. However, as the focal length climbs it takes very expensive optics to maintain a constant f-number. This fact is why the more affordable zoom lenses fail to maintain a constant aperture. A non-constant aperture would be devastating unless the camera featured through-the –lens metering. This modern exposure metering approach makes the non-constant aperture problem moot.
Additionally: As you close focus, the back focus distances increases. This deed invalidates the f-numbers. As you close focus to about ½ meter (20 inches), the f-number error is about 1/3 f-stop so under exposure is likely. Many lens makers stop the forward adjustment (focusing) at this distance.
Specialized lenses to the rescue: The macro lens design uses the same magnifying of the aperture scheme. This allows close focusing without danger of under exposure due to this f-number error now called “bellows factor”. As to magnification: Magnification is a intertwined with focal length and subject distance. As a rule of thumb, longer lenses magnify more than short focal length lenses. However, any lens can image at unity if the lens is racked forward one complete focal length. In other words, a 50mm lens extended to 100mm, it will image at life-size. Likewise, a 100mm lens extended forward so it is 100mm extended, will also image at life-size. To accomplish we extend the lens forward using spacers called tubes or rings. At unit the f-numbers are two f/stops in error. A macro lens solves these problems as they are optimized for close focusing.