Default [Q] How do xda developers port apps and roms?

Almost all custom roms I've seen are made by xda developers, and I'm always curious about how they did that. For example, I own a HTC J one,which doesn't have many roms,then I try to find some tutorials about how to port roms. All I've found are like replcaing some files only. But there're already sense 6.0 port for htc one m7, which is a source closed app as far as I know. So how do they do this job generally? By reverse engineering?